Scanner

1 importjava.util.Scanner;
2 importjava.lang.Math;     // Note: Needed for math functions
3
4 publicclassPaintEstimator {
5 publicstaticvoid main(String[] args) {
6       Scanner scnr = new Scanner(System.in);
7 doublewallHeight = 0.0;
8 doublewallWidth = 0.0;
9 doublewallArea = 0.0;
10 doublegallonsPaintNeeded = 0.0;
11 intcansNeeded = 0;
12
13 finaldoublesquareFeetPerGallons = 350.0;
14 finaldoublegallonsPerCan = 1.0;
15
16 System.out.println(“Enter wall height (feet): “);
17 wallHeight = scnr.nextDouble();
18
19 // Prompt user to input wall’s width
20 System.out.println(“Enter wall width (feet): “);
21 wallHeight = scnr.nextDouble();
22
23 // Calculate and output wall area
24 wallArea = wallHeight * wallWidth;
25 System.out.println(“Wall area:  square feet”);
26
27 // Calculate and output the amount of paint in gallons needed to paint the wall
28 gallonsPaintNeeded = wallArea/squareFeetPerGallons;
29 System.out.println(“Paint needed: ” + gallonspaintneeded + ” gallons”);
30
31 // Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
32 cansNeeded = gallonsPaintNeeded / gallonsPerCan;  //Hint: this line is missing two operations
33 System.out.println(“Cans needed: ” + cansNeeded + ” can(s)”);
34
35 return;
36    }
37 }