4A

The Student Painters Company paints dorm rooms . The rooms have one window and one door. The room is rectangular. The walls are always 8 feet tall. The door way is 80 inches tall by 32 inches wide and the window is 4 feet by 5 feet. Student Painters charge $100 for labor plus the cost of the paint to paint a room. A gallon of paint cost $31.95 and will cover 300 square feet. All four walls (minus the window and door) and the ceiling are painted.

Write a PaintJob class to model a paint job for Student Painters.

PaintJob has a constructor that takes the length and width of the room given as doubles (in that order).

Provide these methods:

Provide Javadoc

You will need to convert the square inches for the door to square feet. There are 144 square inches in a square foot.

Here are some constants you must use

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;

 

You need to define and use constants for the cost of labor, the cost of a gallon of paint, and the number of square feet a gallon will cover. Make these constants accessible to any class. (public static final ...) Don't use any magic numbers in the code.

For the draft, define the constants and instance variables. Write the constructor and the setDimensions, getLength and getWidth methods. provide Javadoc for these methods and constructor and the class itself.

4A draft:
4A final: (new URL as of 2/3/2017)

4B

Write an application InputPractice. (It will need a main method.)

Create a Scanner object and do the following.

Only create one Scanner.

For the draft, create the Scanner and do the first two steps

4B draft:
4B final:

4C

Many people like to have things like towels, shirts, and glassware personalized with the letters of their initials. You are to write a class Letters which represents a person's initials. An Letters class has instance variables of a first name, middle initial (one letter. No period), and last name.

There is no starter file. You will write the whole class.

The Letters class has two constructors (This is called overloading).

Letters class has these methods

Do not use an if statement. You do not need it.

Provide full Javadoc (the class, the constructors, and the methods)

To get the first letter of a string, you can use substring

    String firstLetter = word.substring(0, 1);

For the draft, provide the instance variables and the first constructor. Implement these methods: getFirstName, getMiddleInitial, and getLastName methods. Implement the other methods as stubs. Provide Javadoc. For the stubs, indicate what will be returned in the final not null.

4C draft:
4C final: