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
Cual de las siguientes es una desventaja del uso de las computadoras?
natka813 [3]
Answer: c
Explanation:
7 0
3 years ago
David is taking a test. To answer a question, he first covers up the answer choices. Next, he tries to answer the question. Then
lakkis [162]

Answer:

Multiple choice

Explanation:

I got 100 on the assignment

3 0
3 years ago
Read 2 more answers
The this reference . a) can be used implicitly b) must be used implicitly c) must not be used implicitly d) must not be used 25)
Gnom [1K]

Answer:

yeet

Explanation:

because computers

6 0
3 years ago
Directions: Give the shortcut key for the following commands: 1. Open 2. Save 3. New document 4. Copy 5. Undo 6. Redo 7. Paste 8
stepan [7]

Answer:

Explanation:

1 : Ctrl + X

2 Ctrl + C

3 Ctrl + L

4 Ctrl + V

5 Ctrl + B

6 Ctrl + R

7 Ctrl + I

8 Ctrl + E

9 Ctrl + U

10 Ctrl + Z

11 Ctrl + Y

12 Ctrl + N

End

13 Ctrl + A

Home

14 Ctrl + J

15 Ctrl + 2

16 Ctrl + S

17 Ctrl + 1

18 F12

19 Ctrl + W

-----------

20 Ctrl + K

21 Ctrl + ]

22 Ctrl + (left arrow)

23 Ctrl + (right arrow)

24 Ctrl + [

25 Ctrl + Del

26 Ctrl + 5

27 F1                                                         pls mark me as brainliest and              

                                                                   check all the short cuts

8 0
3 years ago
You’ve been given a new cell phone with a 2 gigabyte data plan. You plan to use your phone for text messages, images, video, and
Katarina [22]

Answer:

IUYTR

Explanation:

5 0
3 years ago
Other questions:
  • If parties in a contract are not _______, the contract can be canceled.
    7·1 answer
  • Select the correct answer.
    15·1 answer
  • An installed theme can be applied by clicking on a theme in the themes group on the ____ tab.
    7·2 answers
  • Adding all the three primary colors-red, green, and blue-at maximum intensity produces the color _____, while adding any two of
    9·1 answer
  • In checking the digital signature, the verifier ____. a. decrypts the digital signature it received with the supplicant public k
    13·1 answer
  • The velocity dimension of Big Data refers to _____.
    15·1 answer
  • Select the one that uses the heading tag correctly. <br><br>a. <br><br><br>b. <br><br>c. <br><br>d.
    12·2 answers
  • Why do guys get jealous when u hangout with another guy that's not them
    6·2 answers
  • True or false: Quality score is an algorithm that scores each of your search ads on spelling and grammar.
    10·1 answer
  • True/False: Functions are ideal for use in menu-drive programs. When a user selects a menu item, the program can call an appropr
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!