-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaintEstimator (2017_12_22 03_38_38 UTC).java
39 lines (27 loc) · 1.3 KB
/
PaintEstimator (2017_12_22 03_38_38 UTC).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
import java.util.Scanner;
public class PaintEstimator {
double getarea(double lenght, double width) {
return lenght * width;
}
public static void main(String[] args) {
PaintEstimator ob = new PaintEstimator();
double gallonsPaintNeeded = 0.0;
double cansNeeded = 0.0;
final double squareFeetPerGallons = 350.0;
final double gallonsPerCan = 1.0;
Scanner scnr = new Scanner(System.in);
System.out.println("Enter wall height (feet): ");
System.out.println("Enter wall width (feet): ");
double wallWidth = scnr.nextDouble();
double wallHeight = 0;
double wallArea = ob.getArea(wallHeight, wallWidth);
System.out.println("Wall area: " + wallArea + " square feet");
gallonsPaintNeeded = wallArea / squareFeetPerGallons;
System.out.println("Paint needed: " + gallonsPaintNeeded + " gallons");
cansNeeded = Math.ceil(gallonsPaintNeeded / gallonsPerCan);
System.out.println("Cans needed: " + cansNeeded + " can(s)");
}
private double getArea(double wallHeight, double wallWidth) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}