Question: 5.19 ** zyLab: Rectangle Sizes Rectangle Sizes In this exercise, we will be creating a method to compare the sizes of two rectangles. Suppose a

 5.19 ** zyLab: Rectangle Sizes Rectangle Sizes In this exercise, we

will be creating a method to compare the sizes of two rectangles.

5.19 ** zyLab: Rectangle Sizes Rectangle Sizes In this exercise, we will be creating a method to compare the sizes of two rectangles. Suppose a graphics program needs to determine whether one rectangle is smaller than another. A rectangle is specified by its diagonally opposite coordinates. For example, if one rectangle has bottom-left coordinate (1,1) and top-right coordinate (2,3), and the second rectangle has bottom-left coordinate (0,0) and top-right coordinate (10,10), then the first rectangle is smaller than the second. Your job is to create such a method that is able to determine if the first rectangle has a smaller area than the second. Hints: - Create a new method called firstRectangleSmallest which takes in the eight values (i.e., the values corresponding to the four coordinate pairs). - Use copy-paste to ensure your method name and parameters exactly match the method name and arguments provided in the main method. - You should not modify the code in the main method. - Declare local variables r1Area and r2Area to make your comparison expression simpler. - Use the abs() function in Java's Math class (requires import static java.lang.Math.abs). - Take great care to check and recheck that your calculations involve the correct values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!