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
NEED HELP NOW 25 POINTS WILL MARK BRAINLIEST!!!
erastova [34]
The answers are:
C
A
Hope it helps :)
6 0
3 years ago
Read 2 more answers
What is generation of compyter​
gavmur [86]

Answer:

the change that computers go through

Explanation:

like 6 generation

6 0
3 years ago
Read 2 more answers
Casey Griggs is a very capable computer engineer. Recently, he noticed a problem that computer engineers have, and thought of a
diamong [38]

Answer:

serendipitous

Explanation:

this happened by chance in a positive manner.  

8 0
3 years ago
Barbara has three computers connected to the same network in her home. What
Anastaziya [24]

Answer:

LAN

Explanation:

i am not sure but I think it is lan

5 0
3 years ago
Which wireless communication is typically limited to six feet of distance?
Anni [7]

Answer:

nfc

Explanation:

8 0
4 years ago
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • Which of the following is a template definition?
    5·1 answer
  • Using social media and sending a blast are examples of
    13·1 answer
  • Case 1-1Tom has just started working as an intern for a local radio station. He is responsible for managing the request line and
    8·1 answer
  • You can combine the algorithms for converting between infix to postfix and for evaluating postfix to evaluate an infix expressio
    13·1 answer
  • Which code will allow Joe to print Coding is fun. on the screen? print("Coding is fun.") print(Coding is fun.) print = (Coding i
    10·2 answers
  • You are given the task of reading in n numbers and then printing them out in sorted order. Suppose you have access to a balanced
    12·1 answer
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    8·2 answers
  • Give an explanation of one network connection (it will every helpful​
    13·1 answer
  • . Which of the following is NOT a
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!