1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marrrta [24]
3 years ago
8

The ABC Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To ca

lculate 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 wideis 120 square feet. To cover that floor with carpet that costs $8per square footwould cost $960. (12x10x8= 960)
Computers and Technology
1 answer:
Annette [7]3 years ago
8 0

Answer:

class RoomDimension

{

double length;

double width;

public RoomDimension(double len, double w)

{

length = len;

width = w;

}

public double getLength()

{

return length;

}

public double getWidth()

{

return width;

}

public double getArea()

{

return length * width;

}

public String toString()

{

String output;

output = "Room dimensions:\nLength: " + length + "\nWidth: " + width + "\nArea: " + getArea();

return output;

}

}

And the code for RoomCarpet.java:

class RoomCarpet //extends RoomDimension

{

RoomDimension size;

double carpetCost;

public RoomCarpet(RoomDimension dim, double cost)

{

size = new RoomDimension(dim.getLength(), dim.getWidth());

carpetCost = cost;

}

public double getTotalCost()

{

return carpetCost;

}

public String toString()

{

String output = size + "\nCarpet cost: $" + carpetCost * size.getArea();

return output;

}

}

You might be interested in
Hello I am currently working on a multi-sim project. In the file I have already created a timer that goes from 00 - 80 and reset
Digiron [165]

// Copyright 2017 The Chromium Authors. All rights reserved.

// Use of this source code is governed by a BSD-style license that can be

// found in the LICENSE file.

'use strict';

/**

* Alias for document.getElementById.

* @param {string} id The ID of the element to find.

* @return {HTMLElement} The found element or null if not found.

*/

function $(id) {

 // eslint-disable-next-line no-restricted-properties

 return document.getElementById(id);

}

/**

* Get the preferred language for UI localization. Represents Chrome's UI

4 0
3 years ago
Are self driving cars essential for the future of transportation
azamat
Yes, I think so at least because what about those who can't physically drive? They would want the experience of being in the driver's seat.
6 0
3 years ago
What does =SUM(B2:B6) mean
dedylja [7]

In Excel the sum B2 and B6 simply means that B2 and B6 Numbers are adding to get a Sum, it actually like the normal Calculator, but in Excel it helps to do the calculation of your your data simple and easy, there is no hard work.

8 0
3 years ago
The Chairman of the Federal Reserve & the Federal Open Market Committee determine the percentage of a deposit which must be
Scrat [10]
Required Deposit Reserve
6 0
4 years ago
The Hudson Engineering Group (HEG) has contacted you to create a conceptual model whose application will meet the expected datab
alexdok [17]

Answer:

The diagram of the ER and depreciation is in the attachments.

3 0
3 years ago
Other questions:
  • To configure a router / modem, what type of IP interface configuration should you apply to the computer you are using?
    8·1 answer
  • You have a server called server1 that is running windows server 2012. what command would you use to delete the ptr record for 10
    5·1 answer
  • . Two or more functions may have the same name, as long as their _________ are different.
    9·1 answer
  • laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of t
    11·1 answer
  • With which type of social engineering attack are users asked to respond to an email or are directed to a website where they are
    9·1 answer
  • Can someone solve this for me please? It’s part of an escape room.
    13·2 answers
  • Which of the following statement is correct? Select one: a. Base register holds the size of a process. b. Limit register holds t
    10·1 answer
  • AI is not embraced everywhere in every industry because _______.
    7·1 answer
  • The different languages that follow specific RULES. These languages use commands
    9·1 answer
  • a) pencil b) ink bottle c) polygon d) eye 3. Under which of the following can an operating system be classified? b) software c)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!