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
alex41 [277]
3 years ago
12

For this exercise, you'll use the Rectangle class below (you can assume that the length and width are measured in feet).

Computers and Technology
1 answer:
dusya [7]3 years ago
8 0

Answer:

The solution code is written in Python:

  1. class Carpet:
  2.    def __init__(self, rect, cost):
  3.        self.size = rect  
  4.        self.costPerSqFoot = cost  
  5.    
  6.    def cost(self):
  7.        carpetCost = self.size.area() * self.costPerSqFoot  
  8.        return carpetCost

Explanation:

Presume that there is existence of Rectangle class as given in the question, Carpet class is written. The Carpet constructor is defined that take Rectangle object,<em> rect</em>, and <em>cost</em> as parameter (Line 2). To create data member of Carpet class, keyword "self" is used to precede with the name of the data members, <em>size </em>and <em>costPerSqFoot </em>(Line 3-4).<em> </em>The data members are initialized with the parameter <em>rect </em>and <em>cost</em>, respectively.

Next, cost method is defined (Line6 - 8). Within the <em>cost </em>method, the area method of Rectangle object is invoked by expression, <em>self.size.area() </em>and<em> </em>this will return the area value and multiplied with the costPerSqFoot to get the carpet cost and return it as output (Line 8).

You might be interested in
What is an online reputation?
taurus [48]

Answer:

Reputation management refers to the influencing and controlling or concealing of an individual's or group's reputation

Explanation:

8 0
3 years ago
Read 2 more answers
How long will the plant have been dead when 87.5 percent of its C-14 has become N-14?
nikdorinn [45]

Answer:

50% - one half life — 5,730 years

25% — two half lifes — 11,460 years

12.5% — three half lifes — 17,190 years

6.25% — four half lifes — 22,920 years

3.125% — five half lifes — 28,650 years

Explanation:

8 0
2 years ago
Which of the following describes the term "false information?"
pav-90 [236]
Inaccurate and misleading
3 0
3 years ago
1. Write a function that will ask the user to enter a value in dollars. The function should calculate and display the equivalent
julia-pushkina [17]

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

   

    valueInDollars();

}

   public static void valueInDollars() {

       double currentMoney, quarters, dimes, nickels, pennies;

       Scanner input = new Scanner(System.in);

       

       System.out.print("Enter a value in dollars: ");

       currentMoney = input.nextDouble();

       currentMoney *= 100;

       quarters = (int)currentMoney / 25;

       currentMoney = currentMoney % 25;

       

       dimes = (int)currentMoney / 10;

       currentMoney = currentMoney % 10;

       

       nickels = (int)currentMoney / 5;

       currentMoney = currentMoney % 5;

       

       pennies = currentMoney;

       

       System.out.print("Quarters: " + quarters + "\n" + "Dimes: " + dimes + "\n" + "Nickels: " + nickels + "\n" + "Pennies: " + pennies);

   }

}

Explanation:

<u>Inside the function:</u>

- Declare the variables

- Ask the user for a value in dollars

- Multiply that value by 100

- Find the amount of quarters, dimes, nickels, and pennies

- Print the values

<u>Inside the main:</u>

- Call the function

3 0
3 years ago
why is it important for young people to start saving early as possible given the principles of interest?
hjlf
<span>Saving at a young age could be a really great investment on your future from years from now. It has several benefits like learning how to handle your money properly, investing to grow your money more and an early retirement with a lot of coins in your pocket for when you want to enjoy traveling more.</span>
5 0
3 years ago
Read 2 more answers
Other questions:
  • "write a program that reads two floating point numbers and prints their sum difference and product."
    13·1 answer
  • A ________ is hardware or software that acts as a filter to prevent unwanted packets from entering a network.
    9·2 answers
  • This type of connection uses radio waves to connect devices on a network.
    15·2 answers
  • A security policy is a
    11·1 answer
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    7·2 answers
  • What is the quickest way to change the format of a table?
    8·1 answer
  • The part of a rocket engine that allows the combustion gases and flames to leave the rocket engine is the
    14·1 answer
  • Which of the following comments are correct? Select all that apply.
    14·1 answer
  • Whats wrong with my code for .addEventListener
    11·1 answer
  • Compare the two items in a summary of qualifications taken from a resumé. Which is better?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!