Question: (50pts) Write a Java program A2p2.java with a unique class named A2p2 and no named packages that accepts one command line argument assumed to be

(50pts) Write a Java program A2p2.java with a unique class named A2p2 and no named packages that accepts one command line argument assumed to be a positive integer N. The program should generate widths and heights (random integers between 5 and 100 inclusive) for some rectangles and print the width and heights and areas for those rectangles whose area is greater than 2022. The program should stop generating the rectangles once N rectangles have been printed and finally report how many rectangles are discarded because their area is not greater than 2022. A sample run can look like the following: [kwang@computer][~/temp] $ java A2p2 4 Large random rectangle 1: width: 93; height: 99; area: 9207. Large random rectangle 2: width: 82; height: 78; area: Large random rectangle 3: width: 43; height: 91; area: Large random rectangle 4: width: 82; height: 50; area: Number of discarded small rectangles is 7. 6396. 3913. 4100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
