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
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have me
RSB [31]

Answer:

Explanation:

The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.

import java.io.*;

import java.util.*;

class Rainfall

{

   Scanner in = new Scanner(System.in);

   private int month = 12;

   private double total = 0;

   private double average;

   private double standard_deviation;

   private double largest;

   private double smallest;

   private double months[];

   public Rainfall()

   {

       months = new double[12];

   }

   public void setMonths()

   {

       for(int n=1; n <= month; n++)

       {

           int answer = 0;

           while (true) {

               System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );

               answer = in.nextInt();

               if (answer > 0) {

                   months[n-1] = answer;

                   break;

               }

           }

       }

   }

   public void getTotal()

   {

       total = 0;

       for(int i = 0; i < 12; i++)

       {

           total = total + months[i];

       }

       System.out.println("The total rainfall for the year is " + total);

   }

   public void getAverage()

   {

       average = total/12;

       System.out.println("The average monthly rainfall is " + average);

   }

   public void getLargest()

   {

       double largest = 0;

       int largeind = 0;

       for(int i = 0; i < 12; i++)

       {

           if (months[i] > largest)

           {

               largest = months[i];

               largeind = i;

           }

       }

       System.out.println("The largest amount of rainfall was " + largest +

               " inches in month " + (largeind + 1));

   }

   public void getSmallest()

   {

       double smallest = Double.MAX_VALUE;

       int smallind = 0;

       for(int n = 0; n < month; n++)

       {

           if (months[n] < smallest)

           {

               smallest = months[n];

               smallind = n;

           }

       }

       System.out.println("The smallest amount of rainfall was " + smallest +

               " inches in month " + (smallind + 1));

   }

   public static void main(String[] args)

   {

       Rainfall r = new Rainfall();

       r.setMonths();

       r.getTotal();

       r.getSmallest();

       r.getLargest();

       r.getAverage();

   }

}

8 0
2 years ago
when a stock or bond certificate is delivered, it must be in good transferable form. if the certificate is badly mutilated, it m
Elena-2011 [213]

Authentication can be done by the issuer of the security.

What do you mean by authentication?

Authentication is the act of proving an assertion, such as a computer system user's identification. Authentication is the process of verifying a person's or thing's identity, as opposed to identification, which is the act of indicating that identity. It could entail validating personal identification documents, verifying the authenticity of a website with a digital certificate, carbon dating an artefact, or guaranteeing that a product or document is not counterfeit.

Only a party with access to particular company documents may authenticate a mutilated certificate. It is most likely the issuer, but it could also be the transfer agent or registrar.

To learn more about authentication
brainly.com/question/28240257

#SPJ4

6 0
1 year ago
Which of these graphic elements combine text, illustrations, and color?
Likurg_2 [28]

Answer:

Send the picture.

Explanation:

8 0
3 years ago
Read 2 more answers
Read the following characteristic:
Ivanshal [37]

Answer:

A goal of procedural programming

An advantage of object oriented programming

A disadvantage of object oriented programming

A drawback of procedural programming

3 0
2 years ago
Where is the spelling checker found in Excel?
laiz [17]
Simply press F7 or go to the tab 'Review' and --> left click 'spelling'. Located in the top panel.

This will enable the spell checking phase. 
7 0
2 years ago
Read 2 more answers
Other questions:
  • All the processing-of work-done on a computer is performed by the what?
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • A database is used instead of a spreadsheet when?
    7·1 answer
  • Given coins of denominations (value) 1 = v1 &lt; v2&lt; … &lt; vn, we wish to make change for an amount A using as few coins as
    11·1 answer
  • How many report charts can be added to the account page layout to meet this requirement? A sales manager would like to look at a
    14·1 answer
  • These data provides the responses of 10 students in class A and in class B who were asked how many hours they slept lastThese da
    6·1 answer
  • Name all mario kart games in order
    15·2 answers
  • In terms of CPU scheduling metrics, __________ is the time at which the job completes minus the time at which the job arrived in
    10·1 answer
  • Which type of shape allows you to add text that can be moved around.
    11·1 answer
  • Create a program that prompts the user for a positive integer then prints a right-aligned pyramid using that number using the st
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!