You have a business painting the insides of planetariums wit

You have a business painting the insides of planetariums with a special, expensive paint. A planetarium is a circular room with a domed roof (a hemisphere) You charges $95.50 a gallon for paint and a gallon will cover 40 square feet. (If we need a fractional gallon of paint, we only charge for what we use since we can use the remainder on another job)

You paint both the cylinder and the hemisphere.

You charge $100 per square yard for labor plus the cost of the paint.

Your job in this program is to finish the class PaintJob which can be used to calculate the price you need to charge the customer.

The constructor takes the height and radius of the cylindrical part of the room as parameters in that order. (Call them height and radius so the provided methods will work)

You will write methods:

1,public void setHeight(double theHeight)
2,public void setRadius(double theRadius)
3,public double getSurfaceArea() - get the surface area to paint, cylinder and dome
4,public double getPaintCost()- you must use the getSurfaceArea method in this calculation. Only calculate surface area once in the code
5,public double getLaborCharge()- you must use the getSurfaceArea method in this calculation. Only calculate surface area once in the code
6,public double getCustomerPrice() - you must use the other methods in this calculation. Only calculate surface area, paint cost, and labor in one place

Provide Javadoc for the class, the constructor, every method, every parameter and every return value..

Declare and use constants for the price of a gallon of paint, the number of square feet it will cover, and the price you charge per square yard as constants.

Declare a constant using public static final ...

Notice you will need to convert units from square feet to square yards to calculate the labor cost. Use the constant provided in the starter file.

The PaintJobTester is provided:

PaintJobTester.java

------------------------------------------------------------------------------------------------------------------------------

This is what I get so far, please help me with the rest:

/**
* Describes a PaintJob of a cylindrical room
* with a domed roof
*/
public class PaintJobCalculator
{
public static final int SQ_FT_PER_SQ_YARD = 9;

private double height;
private double radius;

/**
* sets a new height for room in this paint job
* @param theHeight the new height
*/
public void setHeight(double theHeight)
{
height = theHeight;
}
  
/**
* sets a new radius for room in this paint job
* @param theRadius the new radius
*/
public void setRadius(double theRadius)
{
radius = theRadius;
}
  
public void getSurfaceArea()
{
  
}

}

Solution

/**
* Tester for the PaintJobConstructor class
*/

//PaintJobTester.java
public class PaintJobTester
{
    public static void main(String[] args)
    {
       //Create an instance of PaintJobCalculator with height and radius
        PaintJobCalculator job1 = new PaintJobCalculator(15.0, 20.0);
      
        System.out.printf(\"Surface Area: %4.2f\ \",job1.getSurfaceArea());
        System.out.println(\"Expected: 4398.23\");
        System.out.printf(\"Paint Cost: %4.2f\ \",job1.getPaintCost());
        System.out.println(\"Expected: 10500.77\");
        System.out.printf(\"Labor: %4.2f\ \",job1.getLaborCharge());
        System.out.println(\"Expected: 48869.22\");
        System.out.printf(\"Total: %4.2f\ \",job1.getCustomerPrice());
        System.out.println(\"Expected: 59369.99\");
      
        job1.setRadius(10.0);
        job1.setHeight(25.0);
        System.out.printf(\"Total: %4.2f\ \",job1.getCustomerPrice());
        System.out.println(\"Expected: 29685.00\");
    }
}

------------------------------------------------------------------------------------------------------------------


/**
* PaintJobCalculator.java
*/
public class PaintJobCalculator
{
   //private instance variables
   private double height;
   private double radius;
   private double surfaceArea;
   public static final int SQ_FT_PER_SQ_YARD = 9;  

   //constants
   public static final double ONE_GALLON_COST = 95.5;
   public static final double SQUARE_FEET_PER_GALLON = 40;
   public static final double LABOUR_COST_SQUARE_YARD = 100.0;

   //constructor
   public PaintJobCalculator(double theHeight, double theRadius)
   {
       height = theHeight;
       radius = theRadius;
   }

   //Return surface area
   public double getSurfaceArea()
   {
       surfaceArea = 2 * Math.PI * radius *( height + height);
       return surfaceArea;
   }

   //Return total paint cost of cylinder
   public double getPaintCost()
   {
       surfaceArea = getSurfaceArea();
       return surfaceArea
               / SQUARE_FEET_PER_GALLON * ONE_GALLON_COST;

   }

   //Return labour charge
   public double getLaborCharge()
   {
       //calculate number of square yards of surface area
       double squareYards = getSurfaceArea() / SQ_FT_PER_SQ_YARD;
       //calculate total labour cost
       return squareYards * LABOUR_COST_SQUARE_YARD;
   }

   //Return sum of paint and labour cost
   public double getCustomerPrice()
   {
       return getPaintCost() + getLaborCharge();
   }

   //Set height
   public void setHeight(double theHeight)
   {
       height = theHeight;
   }
   //Set radius
   public void setRadius(double theRadius)
   {
       radius = theRadius;
   }
}

------------------------------------------------------------------------------------------------------------------

Sample Output:

Surface Area: 4398.23
Expected: 4398.23
Paint Cost: 10500.77
Expected: 10500.77
Labor: 48869.22
Expected: 48869.22
Total: 59369.99
Expected: 59369.99
Total: 29685.00
Expected: 29685.00

You have a business painting the insides of planetariums with a special, expensive paint. A planetarium is a circular room with a domed roof (a hemisphere) You
You have a business painting the insides of planetariums with a special, expensive paint. A planetarium is a circular room with a domed roof (a hemisphere) You
You have a business painting the insides of planetariums with a special, expensive paint. A planetarium is a circular room with a domed roof (a hemisphere) You
You have a business painting the insides of planetariums with a special, expensive paint. A planetarium is a circular room with a domed roof (a hemisphere) You

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site