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
If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
Nimfa-mama [501]

Answer:  

For 32 bits Instruction Format:

OPCODE   DR               SR1                   SR2      Unused bits

a) Minimum number of bits required to represent the OPCODE = 3 bits

There are 8 opcodes. Patterns required for these opcodes must be unique. For this purpose, take log base 2 of 8 and then ceil the result.

Ceil (log2 (8)) = 3

b) Minimum number of bits For Destination Register(DR) = 4 bits

There are 10 registers. For unique register values take log base 2 of 10 and then ceil the value.  4 bits are required for each register. Hence, DR, SR1 and SR2 all require 12 bits in all.  

Ceil (log2 (10)) = 4

c) Maximum number of UNUSED bits in Instruction encoding = 17 bits

Total number of bits used = bits used for registers + bits used for OPCODE  

     = 12 + 3 = 15  

Total  number of bits for instruction format = 32  

Maximum  No. of Unused bits = 32 – 15 = 17 bits  

OPCODE                DR              SR1             SR2              Unused bits

  3 bits              4 bits          4 bits           4 bits                17 bits

7 0
3 years ago
A. True
svetlana [45]

Answer : True  

Explanation: Vectors can hold, data of the same type and can automatically expand accordingly and change it’s size. The date stored in vectors should be linear.  

- The syntax for vector is vector<int>v;

- Mostly this is used in C++ as an alternative to arrays  

- If you want to use vector in your program then define it in the header first  i.e.

#include <vector>

- Push back is a function, that is used to insert an element into the vector  

- Pop back removes the element from the vector  


6 0
3 years ago
I need help here thanks forever who helps
lubasha [3.4K]

Answer:

the horse, the man, and the cactus

Explanation:

The horse is running

The man got slung off the horse, so its in motion

The cactus is flying everywhere from the horse.

3 0
1 year ago
Which of the following is the term for software that automatically displays or downloads unwanted offers?
slega [8]
Adware. Adware displays ads and popups. The other options are completely different from each other
5 0
3 years ago
What is is the privacy risks with health care robots?
Ann [662]
Health care robots the key word, being "robots" aren't able to act as we can as humans.

Robots and systems lack the emotional skills that we as humans have, they are not intuitive.

There are many risks in using robots for health care, although, "health care" is a vague term, so I'll cover a few in general:
- Doctor/patient confidentiality is risked when using robots to handle personal medical matters, systems are never 100% secure.

- Robots and systems cannot emphasise with patients and will make decisions based on logic and theoretics, not emotionally - for example, if a patient is in a state of bad mental health, a robot will not be able to effectively analyse the right methods to take.

- The collection, storage and passing-on of patient information is risked as system encryption is never guaranteed.
3 0
3 years ago
Other questions:
  • List the data types that are allowed for SQL attributes.
    7·1 answer
  • Somebody who is good at this stuff, please halp meh ;-;
    6·1 answer
  • An overall indication of the dependability of data may be obtained by examining the ________, credibility, reputation, and _____
    15·2 answers
  • Given the following sequence of integers: 12, 19, 10, 4, 23, 7, 45, 8, 15 Build a heap by inserting the above set, one integer a
    8·1 answer
  • Why are control components necessary in traditional software and generally not required in object-oriented software?​
    11·1 answer
  • In which situation would saving a Word document as a PDF be most useful?
    9·2 answers
  • Please help I will mark brainliest ⚡️⚡️⚡️⚡️
    12·1 answer
  • Suggest names for a coding club
    10·1 answer
  • Difine Mainframe Computer~<br><br><br><br><br><br><br><img src="https://tex.z-dn.net/?f=%20%5C%3A%20%20%5C%3A%20" id="TexFormula
    12·2 answers
  • Explain how to add cell A1 and cell B3 in excel
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!