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
amid [387]
3 years ago
9

ppose we have a Rectangle class that includes length and width attributes, of type int, both set by the constructor. Define an e

quals method for this class so that two rectangle objects are considered equal ifThey have the exact same length and width.They have the same dimensions—that is, they are congruent.They have the same shape—that is, they are similar.They have the same perimeter.They have the same area.
Computers and Technology
1 answer:
vichka [17]3 years ago
8 0

Answer:

Check the explanation

Explanation:

#include <bits/stdc++.h>

using namespace std;

class Rectangle{

  public:

      int length;

      int breadth;

      Rectangle(int l,int b){

          length = l;

          breadth = b;

      }

      int area(){

          return length*breadth;

      }

      int perimeter(){

          return 2*(length+breadth);

      }

      bool equals(Rectangle* r){

          // They have the exact same length and width.

          if (r->length == length && r->breadth == breadth)

              return true;

          // They have the same area

          if (r->area() == area())

              return true;

          // They have the same perimeter

          if (r->perimeter() == perimeter())

              return true;

          // They have the same shape-that is, they are similar.

          if (r->length/length == r->breadth/breadth)

              return true;

          return false;

      }

};

int main(){

  Rectangle *r_1 = new Rectangle(6,3);

  Rectangle *r_2 = new Rectangle(3,6);

  cout << r_1->equals(r_2) << endl;

  return 0;

}

You might be interested in
The right headlight does not function on either high or low beam. Technician A says this could be caused by an open ground on th
dangina [55]

Answer: Technician A is correct.

Explanation: An open ground on the right may be the reason the headlight is not functioning on low or high beam. Most electrical circuit related problems in automotive are caused by open ground.

A ground should be clean, tight and free of corrosion and also making good metal to metal contact.

A ground is an electrical circuit system or connection in an automotive.

A dimmer switch on the other hand is a device that controls the vehicle's headlight functions. If the headlight does not function on high or low on the right. It can't be a dimmer switch, hence it may be ground problem.

4 0
3 years ago
To apply format to text, both the text and the text box must be selected.
Xelga [282]
I say it is true
hope this helps!
5 0
2 years ago
What type of control structure is the default method of the computer reading code?
Delicious77 [7]
The answer is Selection. Hope this helped you
8 0
3 years ago
What do you think about net neutrality??
Tomtit [17]
I think net neutrality should be kept! Removing net neutrality is unfair for all those who use the Internet! I think life would change is net neutrality did. Certain websites (a lot!) would slow down and cause a lot of people inconvenience, and I bet we'd have to pay more to use some sites!!!

NET NEUTRALITY SHOULD BE PRESERVED!!!!
6 0
3 years ago
Read 2 more answers
What are the names of the components (each shown with a leader and a line) of a circuit shown in the diagram?
Goryan [66]

Answer:

The name of the components of the given labelled circuit is:

The box like figure in the given image is the battery source from where the current drawn into the circuit.

A string connecting positive terminal of battery to the bulb is an electric wire through which current flows in the circuit.

A bubble like object in the circuit is a bulb which lights up when current moves through the circuit.

A component connected to the negative terminal of batter source is a switch.

Then open circuit is an open as the key of the switch is open.

8 0
2 years ago
Other questions:
  • Look at the following form. Which input method is the form using to receive the user's favorite activity? What is your favorite
    12·2 answers
  • To see all of the records at once, you should use _______ view. 
    12·2 answers
  • What would be the results of the following code? final int SIZE = 25; int[] array1 = new int[SIZE]; … // Code that will put valu
    9·1 answer
  • Determine the number of cache sets (S), tag bits (t), set index bits (s), and block offset bits (b) for a 1024-byte 4-way set as
    5·1 answer
  • Set methods are also commonly called _____ methods, and get methods are also commonly called _____ methods.
    6·1 answer
  • What is a text based language that can be used to build all kinds of things ????
    9·1 answer
  • How do you remove a key cap without a kaycap remover (keyboard keycap) ​
    11·1 answer
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
  • _____ oversee the work of various types of computer professionals and must be able to communicate with people in technical and n
    5·1 answer
  • By definition, what is the process of reducing security exposure and tightening security controls?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!