- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArea.java
More file actions
Latest commit
29 lines (27 loc) · 980 Bytes
/
Copy pathArea.java
File metadata and controls
29 lines (27 loc) · 980 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
importjava.util.Scanner;
publicclassArea {
publicstaticvoidmain(Stringargs[]) {
Scannersc = newScanner(System.in);
Areaobj = newArea();
doublebase = sc.nextDouble();
doubleheight = sc.nextDouble();
System.out.printf("Area of parallelogram = %.4f",obj.area(base, height));
doubled1 = sc.nextDouble();
doubled2 = sc.nextDouble();
System.out.printf("Area of rhombus = %.4f",obj.area(0.5, d1, d2));
doublea = sc.nextDouble();
doubleb = sc.nextDouble();
doubleh = sc.nextDouble();
System.out.printf("Area of trapezium = %.4f",obj.area(0.5, a, b, h));
sc.close();
}
publicdoublearea(doublebase, doubleheight) {
returnbase * height;
}
publicdoublearea(doublec, doubled1, doubled2) {
returnc * d1 * d2;
}
publicdoublearea(doublec, doublea, doubleb, doubleh) {
returnc * (a + b) * h;
}
}