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
Given the Query Data Type, which of the following is incorrectly matched with the corresponding Storage Data Type?
Tamiku [17]

Answer:

<h2>c) Date : Date</h2>

Explanation:

A type of attribute of data is called data type in computer science, data types tells the interpreter how a person wants to use the data. The basic data types are supported by most of the programming languages, the basic data types are Integers, float, characters, strings, point numbers and arrays. The terminology may differ from one language to other.

3 0
3 years ago
The student cd contains a file named random.txt. This file contains a long list of random numbers. copy the file to your hard dr
Minchanka [31]

Answer:rick roll

Explanation:

trrrrrrrrrrwgd

8 0
2 years ago
The part of the computer that provides acess to the internet is called?
Eva8 [605]

<u>Answer:</u>

<em> </em><em>Modem is an hybrid device,</em><em> which is responsible for modulating and demodulating information. </em><em>It is a transmission medium and also it is a hardware tool used for connecting to internet.</em>

<u>Explanation:</u>

What is modulation?, let us understand. The <em>process of converting analog to digital signal is called modulation and demodulation is vice-versa.</em> The computer connects internet classically using telephone wire.

The <em>telephone wire understands only analog signal and a computer understands only digital signal.</em> So Modem’s role is to take care of this aspect while <em>connecting to the internet.</em>

3 0
3 years ago
Which of the following is used to manage the objects in a database?
kirill [66]

The answer is the B: The Navigation Pane

All the objects in a Microsoft Access database are listed in the Navigation Pane. You can view and manage the categories and groups of objects in the Navigation Pane. You can also hide groups, objects, or the entire Navigation Pane. In addition, you can also use the Navigation pane to sort objects, find objects in a database, and add objects to a custom group.  By default, the navigation pane appears when you open a database in Access.


8 0
3 years ago
Which one of the following characteristics or skills of a ScrumMaster are closelyaligned with coaching?Select one:
bixtya [17]

Answer:

A. Questioning

Explanation:

Questioning is the skill of a scrummaster that is most closely alligned with coaching, inspite of others.

3 0
3 years ago
Other questions:
  • HEY DO U LIKE TRAINS!
    7·1 answer
  • Which of the following is NOT contained on the Slide Show toolbar?
    13·1 answer
  • What computer device works like a central nervous system?
    11·1 answer
  • Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer va
    7·1 answer
  • Stopping, standing, or parking is prohibited _____________.
    14·1 answer
  • 9.6 Code Practice<br> Instructions<br> 1<br> Declare a 4x 5 array called N<br><br> Please helppp
    9·1 answer
  • 3. Using your knowledge of how an ATM is used, develop a set of use cases that could serve as a basis for understanding the requ
    9·1 answer
  • When was "Rick Astley Never Gonna Give You Up" originally made?
    6·2 answers
  • What is computer? Write is features <br><br><br><br><br>​
    14·1 answer
  • Class C Airspace inner ring begins at the __________ and extends vertically (by definition) to MSL charted values that generally
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!