-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCH_10_Problem_Set.java
More file actions
50 lines (37 loc) · 898 Bytes
/
Copy pathCH_10_Problem_Set.java
File metadata and controls
50 lines (37 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class circle{
public int radius;
circle(){
System.out.println("I am non parameter");
}
public circle(int r) {
this.radius= r;
System.out.println("I am parameter of circle");
}
public double area(){
return Math.PI*radius*radius;
}
public double volume(){
return 2*Math.PI*radius;
}
}
class cylinder1 extends circle {
public int height;
cylinder1(int height,int r) {
super(r) ;
System.out.println("I am Parameter of cylinder");
this.height = height;
}
public double volume(){
return Math.PI*radius*radius*height;
}
}
public class CH_10_Problem_Set {
public static void main(String[] args) {
//Problem1
circle c=new circle(5);
cylinder1 d=new cylinder1(5,5);
/*System.out.println(c.area());
System.out.println(c.volume());
System.out.println(d.volume());*/
}
}