- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.java
More file actions
Latest commit
40 lines (39 loc) · 774 Bytes
/
Copy pathShape.java
File metadata and controls
40 lines (39 loc) · 774 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
/**
*
* @author Mudassar
*/
publicclassShape {
doublelength,breadth,height,radius;
ints;
publicvoidrectangle(doublel,doubleb)
{
length=l;
breadth=b;
}
publicvoidtriangle(doublel,doubleb,doubleh)
{
length=l;
breadth=b;
height=h;
}
publicvoidcircle(doubler)
{
radius=r;
}
publicvoidarea(ints1)
{
s=s1;
if(s==0)
{
System.out.println("Area of rectangle:"+(length*breadth));
}
elseif(s==1)
{
System.out.println("Area of triangle:"+(0.5*length*breadth*height));
}
else
{
System.out.println("Area of circle:"+(3.14*radius*radius));
}
}
}