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
frozen [14]
3 years ago
12

Use the script below as a starting point to create a Rectangle class. Your rectangle class must have the following methods;A con

structor that takes a length and width as parametersgetArea - returns the area of the rectangleisSquare - returns True if length and width are equivalentoverloaded equivalence - compares the length and width of two rectangles and returns true if they are equivalent
Computers and Technology
1 answer:
Greeley [361]3 years ago
4 0

Answer:

The solution code is written in Java.

  1. public class Rectangle {
  2.    private double length;
  3.    private double width;
  4.    public Rectangle(double length, double width){
  5.        this.length = length;
  6.        this.width = width;
  7.    }
  8.    public double getArea(){
  9.        return this.length * this.width;
  10.    }
  11.    public boolean rectangleSquare(){
  12.        if(this.length == this.width){
  13.            return true;
  14.        }else{
  15.            return false;
  16.        }
  17.    }
  18.    public boolean equivalence(Rectangle rect){
  19.        if(this.width == rect.width && this.length == rect.length){
  20.            return true;
  21.        }else{
  22.            return false;
  23.        }
  24.    }
  25. }

Explanation:

Create a class, <em>Rectangle</em> (Line 1) and define two private attributes,<em> width </em>and <em>length</em> (Line 3 - 4). The reason to define the attributes as <em>double</em> type is because the width and length are presumed to be either an integer or a decimal value.

Create constructor which takes <em>width</em> and<em> length </em>as parameters (Line 6).

Next, the require methods, getArea(), isSquare() and overloaded equivalence() along with their expected parameters and return output, are created accordingly in Line 11 -28.

You might be interested in
Although a tablet can connect to a cellular network, it cannot be used as a
Misha Larkins [42]

Answer:

A tablet can have mobile data such as MetroPCS. But the tablet can not make phone calls or texts.

7 0
3 years ago
Read 2 more answers
Due to the difficult economic times, increased global competition, demand for customization, and increased consumer sophisticati
Lunna [17]

Answer:

b. False

Explanation:

Difficult economic times, increased global competition, demand for customization, and increased consumer sophistication does not direct companies to hire more employees and outsource middle managers.

Rather, companies tend to invest new technologies, information systems to satisfy the needs in global competition, consumer sophistication and customization.

Middle managers outsourced cannot deal these issues effectively, therefore they need to be company employees.  

In difficult economic times, companies does not want to hire extra employees because of increased cost.

8 0
3 years ago
Que compone una maquina Rube Goldberg (operadores mecánicos- maquinas simples – mecanismos)
Veseljchak [2.6K]

Answer:

dominoes, fans, PVC pipe, magnets, duct tape, marbles, cups or bowls, miniature toy cars, paper towel tubes, string.

------------------------------------------------------------------------------------------------------------

dominó, abanicos, tubos de PVC, imanes, cinta adhesiva, canicas, tazas o cuencos, carros de juguete en miniatura, tubos de toallas de papel, cuerdas.

Explanation:

3 0
2 years ago
Marco makes $65,000 a year as a graphic designer. He makes a charitable donation of $1,000 each year. He also has $5,000 of busi
iogann1982 [59]
The correct answer is $59,000. 
5 0
3 years ago
Read 2 more answers
Which of the following are examples of structured data?
Burka [1]

Answer:taffif

Explanation:

4 0
3 years ago
Other questions:
  • A bus topology network is most often deployed as a peer-to-peer network. <br> a. True <br> b. False
    7·1 answer
  • Please debug the below code in Java please.
    15·1 answer
  • Im bored anyone up for a convo? lets talk.. =D
    7·2 answers
  • Clearing the computer's cache helps store recently-used information.
    8·1 answer
  • How does light move? Shift? Bounce between different objects?
    9·1 answer
  • Dominic's teacher asked him to create a chart or graph to compare the different grade levels in the school's FBLA club. Which ch
    5·2 answers
  • The
    6·1 answer
  • Anyone here play osu! ?
    11·2 answers
  • A mobile application delivers market predictions based on stock data from the stock market data platform. Knowing that the data
    12·1 answer
  • a 2x4 line decoder with enable is implemented using nand gate only. how many nand gate is needed to construct this line decoder?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!