File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ class Circle
2+ {
3+
4+ double r ;
5+ double circumference ()
6+ {
7+ return 2 *3.14 *r ;
8+ }
9+ double area ()
10+ {
11+ return (22 /7 )*r *r ;
12+ }
13+ }
14+ class Box
15+ {
16+ double width ;
17+ double height ;
18+ double depth ;
19+ double area ()
20+ {
21+ double a ;
22+ a =(width *height + height *depth + width *depth )*2 ;
23+ return a ;
24+ }
25+ double volume ()
26+ {
27+ double v ;
28+ v =width *height *depth ;
29+ return v ;
30+ }
31+
32+ }
33+ class MulticlassDemo
34+ {
35+ public static void main (String args [])
36+ {
37+ Circle c = new Circle ();
38+ Box b =new Box ();
39+ c .r =5.0 ;
40+ b .width =3.0 ;b .height =4.0 ;b .depth =5.0 ;
41+ System .out .println ("Circumference Circle: " +c .circumference ());
42+ System .out .println ("Area circle: " +c .area ());
43+ System .out .println ("Area of Box: " +b .area ());
44+ System .out .println ("Volume of Box: " +b .volume ());
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments