forked from mohammedabdulbari/Java-SE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Circle1.java
56 lines (36 loc) · 765 Bytes
/
Circle1.java
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
51
52
53
54
55
56
package circle1;
class Circle
{
public double radius;
public double area()
{
return Math.PI * radius *radius;
}
public double perimeter()
{
return 2*Math.PI*radius;
}
public double circumference()
{
return perimeter();
}
}
class Cylinder extends Circle
{
public double height;
public double volume()
{
return area()*height;
}
}
public class Circle1
{
public static void main(String[] args)
{
Cylinder c=new Cylinder();
c.radius=7;
c.height=10;
System.out.println("Volume "+c.volume());
System.out.println("Area "+c.area());
}
}