Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Carpet Calculator The Westfield Carpet Company has asked you to wrice ad applicatio price of carpeting for rectangular rooms. To calculate the price the
3. Carpet Calculator The Westfield Carpet Company has asked you to wrice ad applicatio price of carpeting for rectangular rooms. To calculate the price the floor (width times length) by the price per square foot of carpet. For example, the of floor that is 12 feet long and 10 feet wide is 120 square feet. To cover that floor carpet that costs $8 per square foot would cost $960. (12 x 10 x 8 960.) cation that calculates t , you multiply the area of rea 1 First, you should create a class named RoomDimension that has two fields:one for the lng of the room, and one for the width. The RoomDimension class should have a method th returns the area of the room. (The area of the room is the room's length multiplied by the room's width.) Next, you should create a RoomCarpet class that has a RoomDimension object as a field h should also have a field for the cost of the carpet per square foot. The RoomCarpet clas should have a method that returns the total cost of the carpet. Figure 6-21 is a UML diagram showing possible class designs and depicting the relation- ships between the classes. Once you have written these classes, use them in an applicai that asks the user to enter the dimensions of a room and the price per square foot desired carpeting. The application should display the total cost of the carpet
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started