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 + ".");
    }

}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

hint:
your "displayResults" method is defined nicely but never called in your main method!

If I wasn't so tired I'd elaborate, but you did say you wanted just a hint!
hint: indenting is nice also!
edit: hint hint: code tags are fun too!

fix it up and show it again!!

Thanks so much! I got it all to work now. I added the code tags, and the actual code is all indented, but when I copy and paste it here, it loses the indents. Is there a better way to cut and paste?
Here it is without the indentations transferring.

import java.util.Scanner;           //For the Scanner class
import java.text.DecimalFormat;     //For the DecimalFormat class

public class paintJobEstimator
{
   public static void main (String[ ] args)
   {
      System.out.println("Program results by Christopher Baldwin for CSCI 2911");
      System.out.println("This program solves assignment 05_04 ");

        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 

        //Create Scanner object for keyboard input.
        Scanner keyboard = new Scanner(System.in);

        //Call subsequent methods in main method
        totalRooms = getTotalRooms();
        totalSquareFeet = getSquareFeet(totalRooms);
        gallons = getGallons(totalSquareFeet);
        costPaint = getCostPaint(gallons);
        labor = getLabor(totalSquareFeet);
        costLabor = getCostLabor(labor);
        costTotal = getCostTotal(costLabor,costPaint);

        //Display the results
        displayResults(gallons, labor, costLabor, costPaint, costTotal);   
   }

   public static double getTotalRooms()
   {
        double totalRooms;  //The total number of rooms to be painted.

       //Create object for keyboard input.
       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;      //Square foot of individual room
        double totalSquareFeet; //Square feet of combined rooms

        //Create a Scanner object for keyboard input.
        Scanner keyboard = new Scanner(System.in);


        //Set accumulator to zero.
        totalSquareFeet = 0;

            //Set up counter to prompt for square foot per room.
            for (int count = 1; count <= totalRooms; count++)

            {

                //Get the number of square foot per room that was previously entered by user.
                System.out.println("Enter the number of square feet for room" + count + ":");
                squareFeet = keyboard.nextDouble();

                //Add them together to get the total square feet being painted.
                totalSquareFeet +=squareFeet;

            }

        return totalSquareFeet;
    }   

    public static double getGallons(double totalSquareFeet)
    {
        double gallons;     //Total number of gallons for job

        //Create a Scanner object for keyboard input.
        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;   //Total cost of paint
        double costGallon;  //Cost per gallon of paint

        //Create a Scanner object for keyboard input.
        Scanner keyboard = new Scanner(System.in);

        //Get the price per gallon from user.  
        System.out.println("What is the price per gallon of paint you will use?");
        costGallon = keyboard.nextDouble();

        //Multiply cost per gallon by the number of gallons needed to determine total paint cost.
        costPaint = costGallon * gallons;

        return costPaint;

    }

        public static double getLabor(double totalSquareFeet)
    {
        double labor;   //Number of hours of labor required for job

        //Create a Scanner object for keyboard input.
        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;   //Total cost of labor

        //Create a Scanner object for keyboard input.
        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;   //Total cost of the job including labor fees and paint.

        //Create a Scanner object for keyboard input.
        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)
    {
        //Create a DecimalFormat object.
        DecimalFormat formatter = new DecimalFormat ("#0.00");

        //Display the formatted variable contents.
        System.out.println("The total number gallons needed for this job are " + formatter.format(gallons) + ".");
        System.out.println("The total labor hours needed for this job are " + formatter.format(labor) + ".");
        System.out.println("The total cost of the paint for this job is $" + formatter.format(costPaint) + ".");
        System.out.println("The total cost of labor for this job is $" + formatter.format(costLabor) + ".");
        System.out.println("The total cost for this paint job is $" + formatter.format(costTotal) + ".");
    }

}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.