Homework 03
Sorting Rectangles!
Due 10/04/2024 by 11:55PM
Due 11/01/2024 by 11:55PM
Objective:
Write a program where the user creates and sorts a collection of rectangles in a variety of ways based on their area, and gives the average area, minimum area, and maximum area.
Requirements:
Example Dialog:
*The following Example Dialog demonstrates the interactions between a user and ONE possible implementation of the required software’s front-end / user interface. The software’s front-end / user interface may be implemented in MANY different ways and will receive full credit as long as it meets the most minimal of the above requirements. While you may use the example dialog as a guide, it is strongly encouraged to create the front-end / user interface in your own way. *
Key |
|
Unhighlighted Text |
Program’s Output |
Highlighted Text |
User’s Input |
Welcome to the Rectangle Sorter!
How many Rectangles are we creating?
5
Enter the length for Rectangle 0
3
Enter the width for Rectangle 0
4
Enter the length for Rectangle 1
12.2
Enter the width for Rectangle 1
5.6
Enter the length for Rectangle 2
7
Enter the width for Rectangle 2
9
Enter the length for Rectangle 3
123
Enter the width for Rectangle 3
654
Enter the length for Rectangle 4
2.2
Enter the width for Rectangle 4
3.14
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
1
Areas Smallest to Largest
6.908000000000001
12.0
63.0
68.32
80442.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
2
Areas Largest to Smallest
80442.0
68.32
63.0
12.0
6.908000000000001
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
3
The Maximum Area is 80442.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
4
The Minimum Area is 6.908000000000001
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
5
The Average Area is 16118.445600000001
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area4. Get Minimum Area5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
9
Welcome to the Rectangle Sorter!
How many Rectangles are we creating?
3
Enter the length for Rectangle 0
1
Enter the width for Rectangle 0
2
Enter the length for Rectangle 1
9
Enter the width for Rectangle 1
9
Enter the length for Rectangle 2
7
Enter the width for Rectangle 2
8
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
1
Areas Smallest to Largest
2.0
56.0
81.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
2
Areas Largest to Smallest
81.0
56.0
2.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
3
The Maximum Area is 81.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
4
The Minimum Area is 2.0
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
5
The Average Area is 46.333333333333336
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
6
Invalid choice.
Choose from the following:
1. Sort Rectangles by Smallest to Largest
2. Sort Rectangles by Largest to Smallest
3. Get Maximum Area
4. Get Minimum Area
5. Get Average Area
9. Reenter Rectangle Data
0. To Quit
0
Goodbye
Finally:
Upload the .java file to the CSCE Dropbox