Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this java question. Please be detailed and not so advance. UML diagram for RoomDimension Class: RoomDimension -length: double -width:double +RoamDimensionen: double,

I need help with this java question. Please be detailed and not so advance.

image text in transcribed

image text in transcribed

UML diagram for RoomDimension Class: RoomDimension -length: double -width:double +RoamDimensionen: double, wid: dauble +RoomDimensionird: Room Dimensioni teetArealy double toString(): String Once you have the two classes, write a test program to ask the user to enter the dimensions of a room and the price per square foot of the desired carpeting. Then display the total cost of the carpet You will write three Java files: 1. RoomDimension.java: defines the RoomDimension class 2. RoomCarpet.java: defines the RoomCarpet class, which has a RoomDimension object as a data field 3. the dema pragram In the demo program: 1. Ask the user to enter the length and width of the floor 2. Create an object from RoomDimension class using the input 3. Ask the user to enter the unit price of the carpet 4. Using 2&3 to create an RoomCarpet object 5. Call the proper methods to calculate and display the total cost of the carpeting 6. Display other information of the two objects using the toString methods defined Requirements: 1. Programs should be well-dacumented 2. Submit the repl.it link of the program I Question: Carpet Calculator The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular raams. To calculate the price, you multiply the area of the floor(width times length) by the price per square foot of carpet. For example, the area of the floor that is 12 feet long and 10 feet wide is 120 square foot. To cover that floor with carpet that costs $8 per square foot would cost $960. First you should create a class named RoomDimension that has twa fields: one for the length of the room and one for the width of the room. The Room Dimension class should have a method that returns the area of the room. Next you should create a RoomCarpet class that has a Room Dimension object as a field. It should also have a field for the cost of the carpet per square foot. The RoomCarpet class should have a method that calculates and returns the cast of the carpet UML diagram for RoomCarpet class RoomCarpet -size: RoomDimension -carpe Cost: double +RoamCarpetdim: Room Dimension, cost: double): +RoomCarpetire: RoomCarpet) +getTotalCostly double getDimensioni: RoomDimension tge.Carpet Casti): double +oString():String

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

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

15.2c What is the OIC, and what does it do?

Answered: 1 week ago

Question

3 How supply and demand together determine market equilibrium.

Answered: 1 week ago