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
Business cards are generally designed so that this item stands out the most.
Sloan [31]
The D. Company Name most likely stands out on a business card with an address or such in smaller font below. A logo does nothing for a business card if a potential customer doesn't even know the name of the business. While logo's are often present on a business card, the company name is far more crucial to enunciate clearly which is of course, important for business's attraction of new customers.

So D. Company Name is my final answer!

Hope this helps! ;)
3 0
3 years ago
One of the earlier applications of crypto-graphic hash functions was the storage of passwords to authenticate usersin computer s
vagabundo [1.1K]

Answer: provided in the explanation part.

Explanation:

This is actually quite long but nevertheless i will make it as basic as possible.

Question (a)  

Attack A:

One way property of hash means that we can't find the input string if given the hash value. The calculation of hash from input string is possible but it is not possible to calculate the input string when given the hash. If the hash function is properly created to have one-way property then there is no way of finding the exact input string. So this attack won't work as the one-way property of hash function can't be broken if the hash function is properly created.

Attack B:

Suppose h() is the hash function. And h(x) = m where x is the string and m is the hash. Then trying to find another string y such that h(y) = m is called finding out the second pre-image of the hash.

Although we can't know the exact initial string for sure, we can by using brute force method find out a second preimage.

This attack will take a very long time. It has the time complexity of 2n. It requires the attacker to have an idea about the kind of passwords that might be used and then brute force all of them to find the string that has the same hash. Each try will have a chance of 1/2n to succeed.

Rainbow attack using rainbow table is often used for such brute-force attack. This comprises a rainbow table which contains passwords and their pre-hashed values.

Therefore, it is not possible to determine the second preimages of h so easily.

Attack C:

Collisions refer to finding out m and m' without knowing any of them. Finding out collisions is easier than finding preimages. This is because after finding out 2n pairs of input/output. The probability of two of them having the same output or hash becomes very high. The disadvantage is that we can't decide which user's hash to break. However, if I do not care about a particular user but want to get as many passwords as possible, then this method is the most feasible.

It has the time complexity of 2n/2.

Hence, this is the attack which has the most success rate in this scenario.

Question (b)

The brute force way of finding out the password usually involves using a rainbow attack. It comprises a rainbow table with millions of passwords and their hashes already computed. By matching that table against the database, the password can be recovered.

Therefore it is often preferred to salt the password. It means we add some random text to the password before calculating the hash.

The salts are usually long strings. Although users usually do not select long passwords, so a rainbow table with hashes of smaller passwords is feasible. But once salt is used, the rainbow table must accommodate for the salt also. This makes it difficult computationally. Although password might be found in the rainbow table. The salt can be anything and thus, make brute-force a LOT more difficult computationally.

Therefore salt is preferred to be added to passwords before computing their hash value.

Question (c)

A hash output length of 80 means there can be exactly 280 different hash values. This means there is at least one collision if 280+1 random strings are hashed because 280 values are used to accommodate all the possible strings. It is not hard with today's computation power to do match against more than this many strings. And doing so increases the probability of exposing a probable password of a user.

Hence, 80 is not a very secure value for the hash length.

cheers i hope this helps!!!!

6 0
3 years ago
Intro to cs 3.7 edhesive g=float(input("Enter your English test grade:")) if(g&lt;=64): print("F") if (g&gt;=65 and g&lt;69): pr
qwelly [4]

Answer:

The correct code for this question:

g=float(input("Enter your English test grade:")) #take input from user.

#check conditions

if (g>=100 and g<=90):

print ("A")

#g greater then equal to 100 and less then equal to 90.

if (g>=89 and g<=80):

print("B")

#g greater then equal to 89 and less then equal to 80.

if (g>=79 and g<=70):

print("C")

#g greater then equal to 79 and less then equal to 70.

if (g>=69 and g<=65):

print("D")

#g greater then equal to 69 and less then equal to 69.

if(g<=64):

print("F")

#g less then equal to 64.

else:

print ("Not a grade")

#not a grade or fail.

Explanation:

In this program, we use to take a value from the user and check the value from the various conditions. To check all the condition we use if-else statement and AND operator that check to the range to together.

If -else is a conditional operator. In that, If block is used to check the true part and else part takes false value, and AND is a logical operator that check the two range together  

5 0
3 years ago
Google Ads was constructed around three core principles, focused on helping businesses reach their online potential. The first o
PolarNik [594]

Answer:

True

Explanation:

Google Ads was constructed around three core principles, focused on helping businesses reach their online potential. The first of these is relevance. Google Ads connects businesses with the right people at the right time. The other principle is control and results.

7 0
3 years ago
Determining Correct Date Function What function text would you use to put today's date and time in a cell? 0 =TODAYO =NOWO O NOW
Murrr4er [49]

Current date formula:

=TODAY()

Current time formula:

=NOW()

As you can see, the =TODAY() formula only includes the day, month and year. The =NOW() function displays more information, showing the day, month, year, hour and minutes (using a 24-hour clock)

if useful mark as brainliest

3 0
3 years ago
Other questions:
  • Sahil is making a graphic novel in which the villain plans to reduce the rate at which energy is released from the Sun. The vill
    7·2 answers
  • One of the attributes in a table in your database depends on another attribute for its meaning. What type of dependency has been
    14·1 answer
  • A sentinel value ________ and signals that there are no more values to be entered:____
    14·1 answer
  • A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
    15·2 answers
  • What are two constraints that continuous-media files have that conventional data files generally do not have?
    12·1 answer
  • To filter a list with the Filter function, on an Excel spreadsheet, you need to perform the following steps: (1) click in any ce
    9·1 answer
  • Write the line of code to calculate the area of a circle with radius 3 and store it in a variable called
    10·1 answer
  • What is the second step when designing an algorithm?
    12·2 answers
  • Anne wants to hide her age by converting it from 13 to 1101. Which number system is Anne converting to?
    13·1 answer
  • Quick I need help ASAP
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!