Question: Goal: In this problem, you will write a class called PaintJob that helps the Student Painters painting company a company that paints dorm rooms calculate

Goal: In this problem, you will write a class called PaintJob that helps the Student Painters painting company a company that paints dorm rooms calculate the painting area and costs of their painting projects.

The dorm rooms have the following aspects:

The rooms have one window and one door

The rooms are rectangular

The walls are 8 ft tall

The doorway is 80 inches tall by 32 inches wide

The window is 4 ft wide by 5 feet tall

All four walls and the ceiling are painted

The painting company has the following costs:

A gallon of paint costs $31.95

A gallon of paint will cover 300 square feet

Student Painters charges $100 per room, plus the cost of paint

A PaintJobTester class is provided for you to verify your PaintJob class works as expected.

Instructions: Start a new BlueJ project called hw4a in the cs46a/homework/hw04 folder. In the BlueJ project, create a class called PaintJobTester and copy the code from Canvas. Do not change this class in any way. Next, create another class called PaintJob and copy over the contents from Canvas.

Fill in this class with the following:

1. A constructor:

public PaintJob(double theLength, double theWidth)

Constructs a new PaintJob object with the length and width of the room to paint. Remember that the job of the constructor is to initialize the instance variables, not to do any calculations.

2. Six methods:

public double getLength()

Gets the length of the room in feet. public double

getWidth()

Gets the width of the room in feet

public void setDimensions(double newLength, double newWidth)

Set a new length and width of the room in feet.

public double surfaceArea()

Get the surface area of the room in square feet, excluding the area of the door and window public

double costOfPaint()

Get the cost of the paint for this job. Do not calculate surface area in this method. Instead, call the surfaceArea() method you defined above. Be sure to charge for the fractional gallons used the leftover paint can be used for another job!

public double totalJobCost()

Gets the cost of this job. Do not calculate surface area or the cost of paint in this method. Call other methods to get these values.

Other tips and guidelines:

Add Javadoc comments to your code this will be part of your grade.

You will need to convert square inches for the door to square feet. There are 144 square inches in a square foot. Do not calculate a priori use variables for this calculation!

You will need to define and use constants for the cost of labor, the cost of a gallon of paint, and the number of square feet that a gallon will cover. Make these constants accessible to any class. Do not use any magic numbers in the code (except the number 2).

In addition to the variables above, define the following constants in your class

public static final int SQ_INCHES_PER_SQ_FOOT = 144;

public static final double WALL_HEIGHT_IN_FEET = 8;

public static final double DOOR_HEIGHT_IN_INCHES = 80;

public static final double DOOR_WIDTH_IN_INCHES = 32;

public static final double WINDOW_HEIGHT_IN_FEET = 5;

public static final double WINDOW_WIDTH_IN_FEET = 4;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!