Programming
Write a static method named randomRects that calculates and displays the area of randomly-generated rectangles. The width and height of each rectangle should be a randomly generated integer between 1 and 10 inclusive. Your method should keep generating random rectangles until an increasing sequence of four areas is printed. In other words, if the last four rectangles generated have areas of a1, a2, a3 and a4 such that a1 < a2 < a3 < a4, the method should print the final message and stop. So your method will generate at least 4 total rectangles but possibly many more, stopping only when it sees 4 in a row with areas in increasing order.
The following calls demonstrate your method's behavior. Your method should match this output format exactly:
Correct Answer:
Verified
Q1: If/Else Simulation
For each call below to
Q3: Programming
Write a static method named graduation
Q4: Parameter Mystery
At the bottom of the page,
Q5: While Loop Simulation
For each call below
Q6: Assertions
For each of the five points
Q7: Expressions
For each expression in the left-hand
Q8: Programming
Write a static method named cheerleader that
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents