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]
4 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]4 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
Deirdre has a hearing disability. One of her friends advised her to use real-time text or RTT on her phone. In which of these
ozzi

The way that real-time text or RTT on her phone can help her is that;

C: On phone calls, it will convert speech into text

<h3>Speech to Text</h3>

We are told that Deirdre has a hearing disability. This means that she has difficulty in hearing words clearly but can read.

Thus, from her friends advice about real time text or RTT, it will aid her because whenever someone calls her on the phone, it can convert the content of the call speech into text.

The missing options are;

A. It will make her phone vibrate to notify her when she gets a phone call

B. It will make her phone vibrate to notify her when she gets a text message.

C. On phone calls, it will convert speech into text. D. While text messaging, it will convert text into speech

Read more on speech to text at; brainly.com/question/2375490

5 0
2 years ago
How did hitles rules in nazi germany exemplify totiltarian rule?
ddd [48]

Answer:

hope this helps if not srry

7 0
3 years ago
what is one example of the decomposers taking from the ecosystem and one of them giving to the ecosystem
adelina 88 [10]
Like when a seed drops on the ground, and a bee come to take some honey. It sticks to the bee and where the bee goes, the bee will rub it off and the seed will start to grow.
8 0
3 years ago
What should you do when you encounter an active directory domain controller for the domain could not be contacted?
Nostrana [21]

Answer:

Issue the Dcdiag on all domain controller servers.

Explanation:

Active directory is a database that holds information of client's authentication for service access in a server. Domain controllers in servers holds these active directories, to replicate client's credentials for quick response to access to the server.

When a server domain can not contact the active directory domain controller, the Dcdiag command is issued on the server to check for connectivity issue to the DNS, AD replication, SYSVOL replication etc.

8 0
3 years ago
A merge is _____.
Aliun [14]
The process of combining information from a variety of sources
7 0
3 years ago
Read 2 more answers
Other questions:
  • A network engineer is examining a configuration implemented by a new intern who attached an ip phone to a switch port and config
    9·1 answer
  • What is data security
    14·1 answer
  • Which method can help you prevent RSI while using a keyboard?
    14·1 answer
  • A girl scout troop with 10 girl scouts and 2 leaders goes on a hike. When the path narrows, they must walk in single file with a
    12·1 answer
  • In which of the following situations should you expect to provide your Social Security number?
    13·1 answer
  • Which one of these tasks is part of the pre-production phase of game development?
    5·2 answers
  • In order for a fault-block mountain to form, a ______ must take place along a fault line and one side must be ________.
    11·1 answer
  • Why do many experts recommand longer time horizonal if you are doing high risk investment
    7·1 answer
  • HELLLLLLLLPPPPPPPPPPPP HHHHHHHHHEEEEEEEEELLLLLLPPPPPP MEEEEEEEE
    12·2 answers
  • What do you think entertainment or gaming platforms will look like in the future?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!