A painting company has determined that for every 115 square feet of wall space,
ID: 3542310 • Letter: A
Question
A painting company has determined that for every 115 square feet of wall space, one gallon of pain and eight hours of labor will be required. The company charged $18.00 per hour ofr labor. Write a program that allows the user to enter the number of rooms to be painted and the price of the pain per gallon. It should also ask for the squre feet of the wall space of 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
then it should display the data on the screen.
S Sample Input (the first 4 lines) and Output (the last line) of the program:
-how many rooms to paint?
-enter the square feet of room1:
-enter the square feet of room2:
-enter the price of the paint per gallon:
-the total estimated cost is:
Notes: Please use the following as a check list to check if your assignment meets all requirements.
1) Name your class, PaintJobEstimator.
2) You should write comments similar to that in AreaRectangle.java with multiple line comment symbols: /**
A painting company has determined that for every 115 square feet of wall space, one gallon of pain and eight hours of labor will be required. The company charged $18.00 per hour ofr labor. Write a program that allows the user to enter the number of rooms to be painted and the price of the pain per gallon. It should also ask for the squre feet of the wall space of 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 then it should display the data on the screen. Sample Input (the first 4 lines) and Output (the last line) of the program: -how many rooms to paint? -enter the square feet of room1: -enter the square feet of room2: -enter the price of the paint per gallon: -the total estimated cost is: Please use the following as a check list to check if your assignment meets all requirements. Name your class, PaintJobEstimator. You should write comments similar to that in AreaRectangle.java with multiple line comment symbols: /** ... */: Specify purpose of the method Specify the return value (if there is one) starting with @return, and then description Specify parameter(s)(if any) starting with @param, and then parameter name and description At least create 5 methods as listed in the problem description. Please notice that all of the five methods need parameter(s) and return a value. Of course feel free to create more methods if you wish (e.g, you can create methods for accepting inputs, too). If you do not create methods other than the main(), your assignment receives 0. Use either the Scanner or the JOptionPane to get inputs from the keyboard. Output for the floating points should be in the format of "#0.00". Your source code should be in right format: Write your name, course number, section number and assignment number before your code in comments. Indent your code Use proper whitespace Write comments for major code blocks.Explanation / Answer
please rate - thanks
any questions-ask
import java.util.*;
import java.text.*;
public class PaintJobEstimator{
public static void main(String[] args)
{int i, numrun, sqft=0,gallons;
double cpg,costlabor,costpaint,totalcost,labor;
Scanner in=new Scanner(System.in);
System.out.print("How many rooms you have? ");
numrun=in.nextInt();
for(i=0;i<numrun;i++)
{System.out.print("what is the square footage of room "+(i+1)+"? ");
sqft+=in.nextInt();
}
System.out.print("What is the cost per gallon of paint? ");
cpg=in.nextDouble();
gallons=numGallons(sqft);
costpaint=Paint(cpg,gallons);
labor=LaborHours(sqft);
costlabor=LaborCost(labor);
totalcost=Total(costpaint,costlabor);
Output(totalcost,sqft,costpaint,costlabor,labor,gallons);
}
public static double LaborHours(int sqft)
{return sqft/115.;
}
public static int numGallons(int sqft)
{return (int)Math.ceil(sqft/115.); //round up assuming can't buy part of a gallon of paint
}
public static double Paint(double cpg, int gal)
{return cpg*gal;
}
public static double LaborCost(double labor)
{return labor*(18.00*8); //assuming you can spend part of an hour painting
}
public static double Total(double paint,double labor)
{return paint+labor;
}
public static void Output(double total, int sqft, double paint, double labor,double hours,int gallons)
{DecimalFormat dec2 = new DecimalFormat("#0.00");
System.out.println("It will cost $"+Double.parseDouble(dec2.format(total))+" to paint "+sqft+" sq ft");
System.out.println("cost breakdown");
System.out.println("Paint costs $"+Double.parseDouble(dec2.format(paint))+" Labor cost $"+Double.parseDouble(dec2.format(labor)));
System.out.println("Labor Hours "+Double.parseDouble(dec2.format(hours))+" Paint used "+Double.parseDouble(dec2.format(gallons))+" gallon");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.