Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program #2 in Lab 1. Remember, A painting company estimates a painting job based on these facts: - Total square feet to be painted and

image text in transcribed
image text in transcribed
Program #2 in Lab 1. Remember, A painting company estimates a painting job based on these facts: - Total square feet to be painted and price for the paint per gallon - One gallon of paint covers 115 square feet of wall area - Painting one gallon of paint takes 8 hours of labor - The company charges $18.00 per hour for labor Display total square feet, number of gallons needed, hours of labor required, cost of paint, cost of labor and total cost of each room, and total cost of painting multiple rooms. 1. Create a class diagram which includes both service and application/client classes. - Name your service class PaintEstimater. This class should include: - Data members - Private variables for data - Public or private constants for given values Note: In the data member section, only need to declare variables and constants for DATA. DO NOT declare a private variable to store a calculated value, which can be returned by a method. Whenever the value is needed, just call that method. Public member methods: - A default constructor - A constructor with parameters to initialize all data members (non-constants) - Other constructors (optional) - A set mutator and accessor for EACH of data members - Five methods, each returns a value (NOT void) - The number of gallons of paint need (round up this value to the nearest whole number) - The hours of labor required - The cost of the paint - The labor charges - The total cost of the paint job Note: There is no need to have a private data member to store a returned value! - Other methods (e.g., for output) (optional) - Add the application class to the diagram and show relationship between the two class. 2. Implement the design in Java code - Your program should reflect the design the class diagram. - If you change data member/field name or data type, or add/remove a variable in Java code, make change in the diagram. - If you change method header (return type, name, and parameter) in Java code, or add/remove a method in Java code, make change in the diagram. - Service class and application class should be written in separate .java files. - Actual user inputs should be conducted in the application class (not in the service class), and then pass as arguments to the constructors or mutators of the service class. - All methods in the service class are instance method, meaning there is NOT this keyword, static, in the method header. - If a value needed in a method is returned in another method, DO NOT recalculate the value. Just call the return method which can be called in an arithmetic expression or passed as an argument directly! - In the application class, - Instantiate at least TWO objects of the PaintEstimater class by using two different constructors, each object represents a room. - Test all mutators and data processing methods defined in the service class. - Format outputs for numeric data (if you have an output method in the service class, format in that method; if not, format them in the main() in the application class)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions