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
marissa [1.9K]
2 years ago
7

Write code which takes inputs and creates two Rectangle objects (using the edhesive.shapes.Rectangle class) and compares them us

ing the equals method.
JAVA!!
Computers and Technology
1 answer:
iogann1982 [59]2 years ago
6 0

Answer:

System.out.println("Enter length:");

Scanner scan = new Scanner(System.in);

Double x = scan.nextDouble();

System.out.println("Enter 2 lengths:");

Double a = scan.nextDouble();

Double b = scan.nextDouble();

Rectangle rect = new Rectangle(x);

Rectangle rect2 = new Rectangle (a,b);

if (rect2.equals(rect)){

 System.out.print("Congruent Rectangles");

}

else {

 System.out.print("Different Rectangles");

}

 }

}

Explanation:

You might be interested in
To break a text string into several lines, which means that the text string continues on the next line, the _____ character shou
Montano1993 [528]

Answer:

To break a text string into several lines, which means that the text string continues on the next line, the backslash character should be used.

4 0
2 years ago
Write a program that prompts the user to enter in a postive number. Only accept positive numbers - if the user supplies a negati
marusya05 [52]

Answer:

The c++ program to check prime numbers is shown below.

#include <iostream>

using namespace std;

int main() {

   int num, prime=0;

   do

   {

       cout<<"Enter a positive number."<<endl;

       cin>>num;

       if(num<1)

       {

           cout<<"Invalid number. Enter a positive number"<<endl;

           cin>>num;

       }

   }while(num<1);

   

   if(num==1 || num==2 || num==3)

       cout<<num<<" is a prime number."<<endl;

   else if(num%2 == 0)

       cout<<num<<" is not a prime number."<<endl;

   else

   {

       for(int k=3; k<num/2; k++)

       {

           if(num%k == 0)

               prime++;

       }    

   if(prime>1)

       cout<<num<<" is not a prime number."<<endl;

   else

       cout<<num<<" is a prime number."<<endl;

   }

}

OUTPUT

Enter a positive number.

-7

Invalid number. Enter a positive number

0

Enter a positive number.

79

79 is a prime number.

Explanation:

The user input is validated for positivity. A do while loop along with an if statement is implemented for verification.

do

   {

       cout<<"Enter a positive number."<<endl;

       cin>>num;

       if(num<1)

       {

           cout<<"Invalid number. Enter a positive number"<<endl;

           cin>>num;

       }

   }while(num<1);

The test for prime number is done by using multiple if else statements.

If user inputs 1, 2, or 3, message is displayed.

Else If user inputs an even number, message is displayed for not prime. This is done by taking modulo of the number upon division by 2.

Else if user inputs neither an even number nor a number less than 3, the modulus of the number is taken with divisors beginning from 3 up to half of the input number.

For this, an integer variable prime is initialized to 0. A number can be completely divisible by itself or by its factors.

If the number is divisible by any of the divisors, value of variable prime is increased by 1. If value of prime is greater than 1, this means that the user input is divisible by more than one divisor. Hence, the given number is not a prime number.

5 0
3 years ago
The first step in the information systems planning process is to ___________.
Basile [38]

Answer: Analyze the organization's strategic plan

Explanation:

 The initial step in the information system is to first analyze the strategic plan of the organization so that we can easily identify the main objective and challenge.

It is basically archived by enlisting the particular objective and function in the planning of information system in the organization.

All the remining option are involve in the remaining step of the information system planning not in the initial step.

Therefore, analyze the organization's strategic plan is correct as it is the first step of the information system planning.  

7 0
2 years ago
What are movies filmed before 1990's?
natita [175]

Answer: Once Upon a Time in the West (1968) PG-13 | 165 min | Western. ...

Cinema Paradiso (1988) R | 155 min | Drama. ...

Blade Runner (1982) R | 117 min | Action, Sci-Fi, Thriller. ...

2001: A Space Odyssey (1968) G | 149 min | Adventure, Sci-Fi. ...

Apocalypse Now (1979) ...

Chinatown (1974) ...

Stardust Memories (1980) ...

Le Notti Bianche (1957)

Explanation:

8 0
2 years ago
20 POINTS!!!
Rina8888 [55]

Answer:

the third one

hope this helps

5 0
3 years ago
Other questions:
  • A Color class has three int color component instance variables: red, green, and blue. Write a toString method for this class. It
    13·1 answer
  • What term is used to describe a function that uses an algorithm to convert an input of letters and numbers into an encrypted out
    9·1 answer
  • According to the Bureau of Labor Statistics, how
    14·1 answer
  • What do you do to add a line or circle to your presentation?
    7·2 answers
  • A ______ is a computer that controls access to the hardware, software, and other resources on a network. mainframe server workst
    10·1 answer
  • B =(-21) (0) + (-50) ÷ (-5)​
    9·1 answer
  • The Curiosity Rover has recently landed on Mars and likes to send Twitter updates on its progress. If a tweet is posted 10 minut
    6·1 answer
  • An animation of a person standing with their arms extended out to their sides. There are 3 dimensional boxes around the torso of
    5·1 answer
  • Internal exception java.net.socketexception connection reset 1.18
    8·2 answers
  • Which statements describe the advantages of using XML
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!