Description
For this assignment, you are going to simulate an online store that sells paint. You will need 3 separate files:
one for the Room class, one for the RoomTester class, and one for the PaintStore class.
Room Class
This class will simulate a room. Each room must have at least one wall. Each wall in a room has the same
height and width.
You will need 3 instance variables for:
Number of walls in the room
The height of the walls
The width of the walls
You will need to include an argument constructor and a no-argument constructor to initialize the instance
variables.
You will need a getter and setter to access each of the instance variables (6 methods total).
You will need a method that calculates and returns the total area of the all the walls in the room.
You will need a toString method that displays the object’s current data.
RoomTester Class
This class will test the methods and constructors of the Room Class.
Create 2 objects, one with the argument constructor and one with the no-argument constructor.
2
On the object constructed with the argument constructor, call all the getter methods to make sure the instance
variables were initialized correctly.
On the object constructed with the no-argument constructor, call all the setter methods and set the instance
variables to the values of your choosing. Then, call all the getter methods to make sure the setters worked
correctly.
Test toString method for each object.
The output that should be produced by this class is shown below in the sample execution section.
PaintStore Class
This class will use the Room class to simulate a customer buying paint to paint a room. The paint is sold in one
gallon cans. Each can of paint costs $8.99. One gallon of paint can cover 250 sqft.
The program will greet the customer and then asks them for the paint color, number of walls, height of one wall,
and width of one wall. Assume that all the walls in the room have the same height and width. Then, the program
will calculate and display the number of cans of paint the customer needs to buy (use the ceil method from the
Math class to round to the next whole number), and the total square feet of the walls. Finally, calculate and
display the subtotal, tax, and total. The sales tax is 0.11.
Create 1 object of the Room class. Initialize the instance variables with the customer’s input.
Use the getter methods and the method that calculates the total area of the walls to display the information, as
shown below.
The output that should be produced by this class is shown below in the sample execution section.
3
Sample Execution:
RoomTester Class Output:
TESTING ARGUMENT CONSTRUCTOR
—————————-
3
Expected: 3
10.0
Expected: 10.0
15.0
Expected: 15.0
450.0
Expected: 450.0
Testing toString Method
———————–
Walls: 3
Height: 10.0 ft
Width: 15.0 ft
TESTING NO-ARGUMENT CONSTRUCTOR
——————————-
5
Expected: 5
8.0
Expected: 8.0
11.0
Expected: 11.0
440.0
Expected: 440.0
Testing toString Method
———————–
Walls: 5
Height: 8.0 ft
Width: 11.0 ft
4
PaintStore Class Output:
Welcome to the Paint Store!
===========================
Step 1: Choose your paint color
——————————-
purple green
blue teal
yellow red
Enter a paint color: purple
Step 2: Tell us about your room
——————————-
Enter the number of walls in the room: 4
Enter the height of one wall: 8
Enter the width of one wall: 15
Step 3: Paint needed
——————–
You need 2 cans of purple paint to cover 480.0 sqft.
Step 4: Final price
——————-
Subtotal: $17.98
Tax: $1.98
Total: $19.96
Thank you for shopping with us!
5
Requirements:
Use an updated comment block
Your program should use the following comment block at the very beginning of your program.
// Name: Your Name Date Assigned: Fill in
//
// Course: CSCI 2003 42733 Date Due: Fill in
//
// Instructor: Ms. Greer
//
// File name: Fill in
//
// Program Description: Brief description of what the program does.
Use appropriate comments throughout the program
Make good use of whitespace
Your output should look exactly like the sample output if using the same data.
Deliverables:
Room.java file
RoomTester.java file
PaintStore.java file
Upload all 3 files to Moodle
Grading:
Total Points 15 points
Room Class 6 points
Declare instance variables correctly 1 point
Constructors are correct 1 point
Getters are correct 1 point
Setters are correct 1 point
Method that calculates total wall area is correct 1 point
toString method is correct 1 point
RoomTester Class 4 points
Tests both types of constructors 1 point
Tests all getters correctly 0.5 point
Tests all setters correctly 0.5 point
Tests wall area method is correctly 1 point
Tests toString methods on both objects 1 point
PaintStore Class 5 points
Creates 1 object correctly 1 point
Gets all necessary user input correctly 1 point
Initializes instance variables correctly 1 point
Calculates number of gallons needed correctly 1 point
Calculates subtotal, tax, and total correctly 1 point
Not enough comments/whitespace -1 point
Output does not match the sample executions given in the assignment -1 point
Bad variable names, method names, and/or class names -1 point
6