Question
I need help with this problem. A painter company has determined that for every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $18.00 per hour for labor. Write a program that allows the user to enter the number of rooms to be painted and the price per gallon. It should also ask for the square feet of wall space in each room. The program should have methods that return the following data.
•The number of gallons of paint required
•The hours of labor required
•The cost of paint
•The labor charges
•The total cost of the paint job
Then it should display the data on the screen.
Thanks in advance!
Explanation / Answer
import java.util.Scanner; public class PaintJobEstimator { private static Scanner keyboard; public static void main(String[] args) { // open keyboard input keyboard = new Scanner(System.in); // find # of square feet double squareFeet = getSquareFeet(getRooms()); System.out.printf("Total cost: %.2f ", getTotalCost(squareFeet)); } public static double getTotalCost(double squareFeet) { // for efficiency, output of helper methods will be printed here double price = getPricePerGallon(); double gallons = getNumGallonsOfPaint(squareFeet); System.out.printf("Gallons of paint required: %.2f ", gallons); double laborTime = getLaborTime(squareFeet); System.out.printf("Hours of labor required: %.2f ", laborTime); double paintCost = gallons * price; System.out.printf("Paint cost: %.2f ", paintCost); double laborCost = getLaborCost(laborTime); System.out.printf("Labor cost: %.2f ", laborCost); return laborCost + paintCost; } public static double getPricePerGallon() { System.out.print("Enter the price per gallon of paint: "); return keyboard.nextDouble(); } public static int getRooms() { System.out.print("Enter the number of rooms: "); return keyboard.nextInt(); } public static double getSquareFeet(int numRooms) { double output = 0.0; for(int i = 0; i