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
2.5 code practice
Mamont248 [21]

Answer:

try declarimg smt before the int eg answer=int(input("your answer"))

7 0
3 years ago
Describe the difference between information poor and information rich society?​
Nadya [2.5K]

Answer:

The “Information poor” are consumers who use traditional mass media information such as television, DVDs, radios and magazines. ... On the opposite “information rich” stands for a new elite within the information society.

7 0
3 years ago
Read 2 more answers
If a menu item requires additional information from the user, the Windows standard is to place a(n) ____ at the end of the capti
elena-s [515]

Answer:

elipses

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the windows standard in this situation would be to place an ellipses at the end of the caption. This is because in the English language an ellipses (...)  usually indicates an intentional omission of a word or sentence, which in computer science is used to give the user an indication that it requires further user input.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
4 years ago
Carlos wrote a check for $44.92 to pay his gas bill. He’ll use the check register to record his transaction. What will be his ne
Finger [1]

Answer:

-44.92

Explanation:

If he has no money hell be in the hole

8 0
3 years ago
What are the advantages of using digital signals over analog signals? Scientist have found advantages when they convert digital
Viktor [21]

Answer:

Hope it Helps

Explanation:

Brainliest please

6 0
3 years ago
Read 2 more answers
Other questions:
  • To view the contents of a file that was compressed with the bzip2 utility, you must used the ____________________ command.
    9·1 answer
  • जिल्ला । स्तरीय = 'जिल्ला स्तरीय' भए जस्तै तलका शब्दमा स्तरीय जोडेर
    12·1 answer
  • What is not true of credit scores?
    11·1 answer
  • Write two statements to read in values for my_city followed by my_state. Do not provide a prompt. Assign log_entry with current_
    13·1 answer
  • "It's inventiveness ,uncertainty and futuristic ideas,typically deals with science and technology,,what is it called??
    12·1 answer
  • 1. Which sentence best expresses the main idea
    12·1 answer
  • Do software engineers save millions of dollars in usa
    6·1 answer
  • PLEASE PLEASE PLEASE PLEASE help me Im completly lost will give brainliest and 50 points
    8·2 answers
  • Fast i need now ill give anything
    13·2 answers
  • your organization has decided to use dhcp for ipv6. you want all windows 10 systems using ipv6 to get all of their tcp/ip inform
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!