/* program to calculate amount of paint needed */ import java.util.*; public class painter { public static void main (String[] args) throws IOException { Scanner keyboard = new Scanner(System.in); final int SQFTPERQUART = 200; final int QUARTSPERGAL = 4; double ceiling = 0; int totalquarts, gals, quarts; double width, length, height; double walls; String color; System.out.println("Welcome to the Paint Estimator Program!"); System.out.println("Please enter all room dimensions in feet."); // ROOM 1 System.out.println("enter room 1 color, width, length, height:"); color = keyboard.next(); width = keyboard.nextDouble(); length = keyboard.nextDouble(); height = keyboard.nextDouble(); walls = width * height * 2 + length * height * 2; // wall sq ft walls *= 2; // double coat ceiling = ceiling + width * length; // one coat totalquarts = (int) Math.ceil(walls / SQFTPERQUART); gals = totalquarts / QUARTSPERGAL; quarts = totalquarts % QUARTSPERGAL; System.out.println(color + " will need " + gals + " gallon(s) and " + quarts + " quart(s)"); // ROOM 2 System.out.println("enter room 2 color, width, length, height:"); color = keyboard.next(); width = keyboard.nextDouble(); length = keyboard.nextDouble(); height = keyboard.nextDouble(); walls = width * height * 2 + length * height * 2; // wall sq ft walls *= 2; // double coat ceiling = ceiling + width * length; // one coat totalquarts = (int) Math.ceil(walls / SQFTPERQUART); gals = totalquarts / QUARTSPERGAL; quarts = totalquarts % QUARTSPERGAL; System.out.println(color + " will need " + gals + " gallon(s) and " + quarts + " quart(s)"); // ROOM 3 System.out.println("enter room 3 color, width, length, height:"); color = keyboard.next(); width = keyboard.nextDouble(); length = keyboard.nextDouble(); height = keyboard.nextDouble(); walls = width * height * 2 + length * height * 2; // wall sq ft walls *= 2; // double coat ceiling = ceiling + width * length; // one coat totalquarts = (int) Math.ceil(walls / SQFTPERQUART); gals = totalquarts / QUARTSPERGAL; quarts = totalquarts % QUARTSPERGAL; System.out.println(color + " will need " + gals + " gallon(s) and " + quarts + " quart(s)"); // do ceiling computation totalquarts = (int) Math.ceil(ceiling / SQFTPERQUART); gals = totalquarts / QUARTSPERGAL; quarts = totalquarts % QUARTSPERGAL; System.out.println("ceiling will need " + gals + " gallon(s) and " + quarts + " quart(s)"); } }