I wrote the following code, and it seems to be working well up until the end. I do not get any error messages, but the last method has 5 lines that are supposed to print out. Nothing prints. Any ideas? Hints? Clues? Thanks!
public class paintJobEstimator
{
public static void main (String[ ] args)
{
double rooms;
double totalRooms; //number of rooms to paint
double squareFeet; //number of square feet per room
double totalSquareFeet; //total square feet for the job
double gallons; //number of gallons required for the job
double costGallon; //cost per gallon of paint
double labor; //number of labor hours required for the job
double costPaint; //cost of paint for the job
double costLabor; //cost of labor for the job
double costTotal; //cost of total job
Scanner keyboard = new Scanner(System.in);
totalRooms = getTotalRooms();
totalSquareFeet = getSquareFeet(totalRooms);
gallons = getGallons(totalSquareFeet);
costPaint = getCostPaint(gallons);
labor = labor(totalSquareFeet);
}
public static double getTotalRooms()
{
double totalRooms;
Scanner keyboard = new Scanner(System.in);
//Get the number of rooms to be painted from the user.
System.out.print("How many rooms are going to be painted?");
totalRooms = keyboard.nextDouble();
return totalRooms;
}
public static double getSquareFeet(double totalRooms)
{
double squareFeet;
double totalSquareFeet;
Scanner keyboard = new Scanner(System.in);
//get the number of square foot per room that was previously entered by user. Add them together to get the total square feet being painted.
//Set accumulator to zero.
totalSquareFeet = 0;
//
for (int count = 1; count <= totalRooms; count++)
{
System.out.println("Enter the number of square feet for room" + count + ":");
squareFeet = keyboard.nextDouble();
totalSquareFeet +=squareFeet;
}
//
return totalSquareFeet;
}
public static double getGallons(double totalSquareFeet)
{
double gallons;
Scanner keyboard = new Scanner(System.in);
//divide total square feet by 118 to determine the number of paint gallons needed for the job.
gallons = totalSquareFeet/118;
return gallons;
}
public static double getCostPaint(double gallons)
{
double costPaint;
double costGallon;
Scanner keyboard = new Scanner(System.in);
//Get the price per gallon from user, then multiply that by the number of gallons needed to determine total paint cost.
System.out.println("What is the price per gallon of paint you will use?");
costGallon = keyboard.nextDouble();
costPaint = costGallon * gallons;
return costPaint;
}
public static double labor(double totalSquareFeet)
{
double labor;
Scanner keyboard = new Scanner(System.in);
//get the number of labor hours required by dividing 115 by 8- the number of labor hours per 115 sq. ft.
labor = 8 * (totalSquareFeet/115);
return labor;
}
public static double getCostLabor(double labor)
{
double costLabor;
Scanner keyboard = new Scanner(System.in);
//Get the cost of labor by multiplying the labor hours by 18, the company charge.
costLabor = 18 * (labor);
return costLabor;
}
public static double getCostTotal(double costLabor, double costPaint)
{
double costTotal;
Scanner keyboard = new Scanner(System.in);
//Calculate the total cost for the paint job by adding costLabor and costPaint
costTotal = costLabor + costPaint;
return costTotal;
}
public static void displayResults(double gallons, double labor, double costPaint, double costLabor, double costTotal)
{
System.out.println("The total number gallons needed for this job are " + gallons + ".");
System.out.println("The total labor hours needed for this job are " + labor + ".");
System.out.println("The total cost of the paint for this job is " + costPaint + ".");
System.out.println("The total cost of labor for this job is " + costLabor + ".");
System.out.println("The total cost for this paint job is " + costTotal + ".");
}
}