The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms. 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 floor that is 12 feet long and 10 feet wide is 120 square feet. To cover that floor with carpet that costs $8 per square foot would cost $960. (12 × 10 × 8 = 960.) First, you should create a class named RoomDimension that has two FeetInches objects as attributes: one for the length of the room and one for the width. (You should use the version of the FeetInches class that you created in Programming Challenge 11 with the addition of a multiply member function. You can use this function to calculate the area of the room.) The RoomDimension class should have a member function that returns the area of the room as a FeetInches object. Next, you should create a RoomCarpet class that has a RoomDimension object as an attribute. It should also have an attribute for the cost of the carpet per square foot. The RoomCarpet class should have a member function that returns the total cost of the carpet. Once you have written these classes, use them in an application that asks the user to enter the dimensions of a room and the price per square foot of the desired carpeting. The application should display the total cost of the carpet.

Answers

Answer 1

Answer:

Answered below

Explanation:

#program is written in Java

class RoomDimension{

double length;

double width;

RoomDimension (double length, double width){

this.length = length;

this.width = width;

}

public double roomArea ( ){

return length * width;

}

}

class RoomCarpet{

RoomDimension rd;

double price;

RoomCarpet ( RoomDimension rd, double price){

this.rd = rd;

this.price = price;

}

public double totalCost( ){

double area = rd.roomArea();

return area * price;

}

}


Related Questions

BitTorrent, a P2P protocol for file distribution, depends on a centralized resource allocation mechanism through which peers are able to maximize their download rates.
True or False?

Answers

Answer:

yes. it is true. mark as brainlest

ERIC'S Company sells cement at 30.0 Ghana Cedis per bag. The company

however gives discount of 15% for customers that buy 100 or more bags, and 0% for

customers that buy less than 100 bags.
Write a pseudo code and present a flowchart that

will display the discount percentage when the quantity of bags purchased is entered.​

Answers

Answer:

The pseudocode is as follows:

Input Quantity

Discount = 0%

If Quantity >= 100:

    Discount = 15%

Print Discount

See attachment for flowchart

Explanation:

This line gets the quantity from the user

Input Quantity

This line initializes the discount to 0%

Discount = 0%

This checks if quantity is more than or equal to 100

If Quantity >= 100:

If yes, discount is set to 15%

    Discount = 15%

This prints the discount percentage

Print Discount

See attachment for flowchart

In the early days of the Internet, most access was done via a modem over an ________.
Question 10 options:

Analog telephone line

Fax

Telegram

None of the above

Answers

Answer:

analog telephone line

Explanation:

I hope this helps! :)

☁️☁️☁️☁️☁️☁️☁️☁️☁️

Other Questions
PA ANSWER PO THANK YOU help the pictures underneath Mark spent $60 dollars on 4 shirts. How much was one shirt Can someone help me plz?? and if u answer it can u explain how you got the answer? thx :) how does romeo's impulsive nature impact the the action in the play and what you know of the final outcome of this tragedy? Please help meThe following graph shows a proportional relationship. What is the constant of proportionality between y and x in the graph?please David's money is three times Siti's money. Farid has RM 150 less than Siti. The total amount of their money is RM 2 000. How much do each of them have? If a solution containing 24.0 g of a substance reacts by first-order kinetics, how many grams remain after three half-lives? what does"American Dream" means to you Can someone help me thank you The body weighing 8kg moves in a straight line uniformly accelerated with an acceleration of 3m / s? on a horizontal surface, under the action of force 60N.Find a) What is the friction force acting on the body) The coefficient of friction between the body and the surface where it moves Anyone knows this? Please answer... Spam will be reported. find the value of y the nth term of a sequence is n+7work out the 10th term What value of x and y will make the polygon a parallelogram 105V15x please be correct!!!!!! Reward brainliest!! Which of these elements show that "A Letter to the Editor" is not a mysteryplay? Choose the three correct answers.A. It has lines of dialogue that give the setting.B. It gives information instead of having action.C. It is a letter instead of a drama.D. It is a written work meant to be in a newspaper.E. It centers on solving something using clues. PLEASE HELP!!!! Kevin has 25 dollars. MP3 downloads cost 0.75 each. How many songs can he download and still have to spend?A. Write an inequality that represents Kevin's situation. B. How many downloads can Kevin purchase? Justify your answerC. Graph the solution on a number line The brakes of a lorry are in a poor conditionWhat effect will the condition of the brakes have on thinking distance and the brakingdistance of the lorry? BIG IDEAS MATHCourse 3: CA > Chapter 7: Approximating Square Roots > Section Exercises 7.4 > Exercise 16Classify the real number shown below.V15Choose all that apply.-irrational-rational-integer-whole-natural