-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerimeter_Area_Paralleogram.java
More file actions
57 lines (57 loc) · 1.19 KB
/
Copy pathPerimeter_Area_Paralleogram.java
File metadata and controls
57 lines (57 loc) · 1.19 KB
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
57
import java.util.Scanner;
class Perimeter_Area_Paralleogram
{
public static void main(String args[])
{
double x,y,z;
Scanner sc=new Scanner(System.in);
System.out.println("enter the length,breadth,height");
x=sc.nextDouble();
y=sc.nextDouble();
z=sc.nextDouble();
Area obj=new Area(x,y,z);
obj.doArea();
obj.show();
}
}
class Area extends Perimeter
{
double h;
double area;
public Area(double length, double width, double height)
{
super(length, width);
h = height;
area = 0.0;
}
public void doArea()
{
area = b * h;
}
public void show()
{
super.show();
System.out.println("Height: " + h);
System.out.println("Area: " + area);
}
}
class Perimeter
{
double a;
double b;
public Perimeter(double length, double width)
{
a = length;
b = width;
}
public double calculate()
{
return 2.0 * (a + b);
}
public void show()
{
System.out.println("Length: " + a);
System.out.println("Breadth: " + b);
System.out.println("Perimeter: " + calculate());
}
}