L10a

Due by the end of this meeting

Starter Files:


SUBMIT   /   Submission Summary

Restricted Generic Types

Activity 1
Make a program called Lab10 that creates a List of at least ten Rectangle objects with widths and heights between 1.0 and 10.0. Print them out, one per line using a method printRectangles.

For example, your output might be

- 5.3x3.4 Rectangle - 3.0x7.6 Rectangle - 4.1x6.2 Rectangle - 2.9x4.0 Rectangle - 9.4x1.4 Rectangle - 9.0x2.7 Rectangle - 2.8x7.7 Rectangle - 6.4x4.4 Rectangle - 3.9x1.3 Rectangle - 3.3x2.0 Rectangle
Activity 2
Extend the program above by using the methods from Quick to find the three smallest by width and the three largest by area. Print out the whole List one element per line after each operation.

Do not sort the whole array.

For example, your output might be:

Original List - 4.7x5.6 Rectangle - 9.4x9.2 Rectangle - 5.4x4.3 Rectangle - 3.1x5.2 Rectangle - 5.0x1.4 Rectangle - 3.4x5.8 Rectangle - 1.6x7.7 Rectangle - 7.6x2.8 Rectangle - 2.5x3.9 Rectangle - 7.3x6.6 Rectangle With three narrowest at front: - 1.6x7.7 Rectangle - 2.5x3.9 Rectangle - 3.1x5.2 Rectangle - 3.4x5.8 Rectangle - 4.7x5.6 Rectangle - 5.4x4.3 Rectangle - 9.4x9.2 Rectangle - 7.6x2.8 Rectangle - 7.3x6.6 Rectangle - 5.0x1.4 Rectangle With three largest areas at end: - 5.0x1.4 Rectangle - 2.5x3.9 Rectangle - 1.6x7.7 Rectangle - 3.1x5.2 Rectangle - 3.4x5.8 Rectangle - 7.6x2.8 Rectangle - 5.4x4.3 Rectangle - 4.7x5.6 Rectangle - 7.3x6.6 Rectangle - 9.4x9.2 Rectangle
Your grade will be based on the following rubric:

Submit this/these files:


SUBMIT   /   Submission Summary