Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started