Paint Job Estimator In class assignment is to finish up the PaintJobEstimator pr
ID: 3767688 • Letter: P
Question
Paint Job Estimator
In class assignment is to finish up the PaintJobEstimator program we started in class. We worked on the difficult calculation pieces for the number of gallons of paint required and hours of labor required in class. Please attempt the last three methods for calculating the cost of the paint, the cost for the labor, and the total cost for the job!!
A painting 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 of the paint per gallon. The program will prompt 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 the paint
The labor charges
The total cost of the paint job.
It will display this data on the screen (ie. either the console or in a JOptionPane message dialog).
Explanation / Answer
Here is the code for you. If you have any further queries, just get back to me.
import java.io.*;
import java.util.*;
class PaintJobEstimator
{
public static double gallonsPaintRequired(double wallSpace)
{
return wallSpace / 115;
}
public static double laborHoursRequired(double wallSpace)
{
return (wallSpace / 115) * 8;
}
public static double costOfPaint(double numberOfGallons, double pricePerGallon)
{
return numberOfGallons * pricePerGallon;
}
public static double costOfLabor(double laborHours)
{
return laborHours * 18;
}
public static double totalCost(double paintCost, double laborCost)
{
return paintCost + laborCost;
}
public static void main(String[] args)
{
int numOfRooms;
double wallSpace = 0;
double paintPricePerGallon;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number of rooms: ");
numOfRooms = sc.nextInt();
System.out.print("Enter the price of paint per gallon: ");
paintPricePerGallon = sc.nextDouble();
for(int i = 1; i <= numOfRooms; i++)
{
System.out.print("Enter the square feet of wallspace for room "+i+": ");
double temp = sc.nextDouble();
wallSpace += temp;
}
System.out.println("Number of gallons of paint required is: "+gallonsPaintRequired(wallSpace));
System.out.println("Number of labor hours required is: "+laborHoursRequired(wallSpace));
System.out.println("Cost of paint: "+costOfPaint(gallonsPaintRequired(wallSpace), paintPricePerGallon));
System.out.println("Labor Cost: "+costOfLabor(laborHoursRequired(wallSpace)));
System.out.println("Total Paint Job Cost: "+totalCost(costOfPaint(gallonsPaintRequired(wallSpace), paintPricePerGallon), costOfLabor(laborHoursRequired(wallSpace))));
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.