-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathareaCalculation
More file actions
40 lines (34 loc) · 1017 Bytes
/
areaCalculation
File metadata and controls
40 lines (34 loc) · 1017 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
public class DoThing {
int area;
int surfacearea;
int length;
int width;
int height;
public DoThing(int length1, int width1, int height1) {
System.out.println("We have a " + length1 + " by " + width1 + " by " + height1 + " prism");
length = length1;
width = width1;
height = height1;
}
public void calculateArea() {
area = length * width * height;
}
public void calculateSurfaceArea() {
surfacearea = 2*(length * width) + 2*(length * height) + 2*(height * width);
}
public int returnSurfaceArea(){
System.out.println("The surface area is: " + surfacearea);
return surfacearea;
}
public int returnArea() {
System.out.println("The area of the " + length + " by " + width + " by " + height + " prism is " + area);
return area;
}
public static void main(String[] args) {
DoThing calculations = new DoThing(684,792,784);
calculations.calculateArea();
calculations.returnArea();
calculations.calculateSurfaceArea();
calculations.returnSurfaceArea();
}
}