school/old/painting-a-wall/painting_a_wall.java
2021-01-20 08:09:18 -05:00

30 lines
692 B
Java

import java.util.Scanner;
public class painting_a_wall {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double height, width;
final double square_feet_per_gallon = 350;
System.out.println("Enter wall height (feet):");
height = scnr.nextDouble();
System.out.println("Enter wall width (feet):");
width = scnr.nextDouble();
System.out.println("Wall area: " + height*width +
" square feet");
System.out.println("Paint needed: " +
(height*width)/square_feet_per_gallon +
" gallons");
System.out.println("Cans needed: " +
(int)Math.ceil((height*width)/square_feet_per_gallon)+
" can(s)");
scnr.close();
}
}