The Assignment
This assignment is very open ended. We know that people will interprete it differently. We're just looking to let you have some fun -- while practicing the things we've learned recently: in-order insertion, reoving items without creating holes, and constructing menus. If you convince us of that, and that you can, in general, write reasonable Java code, you win.Specifically, this assignment asks you to construct three things:
- A class that describes a class of objects of your choosing. This class should have more than two properties, and these properties should be of at least two different types. At least one such property must be publicly accessible and at least one must be publicly settable. It should have a constructor and a toString() method. It should also be Comparable and override Object's equals() method. The equals() method should check to see if two instances have exactly the same properties. The compareTo() method should look at a subset or aggregation of the properties to rank objects by quality. It must be possible for two objects to be .equal() without necessarily having compareTo() return 0. In other words, compareTo() can't be examining the same exact property or properties as .equals().
This class should be similar to the basic classes that we implemented during class today. The example varied by section: FootballTeam, VideoMovie, SodaPop, and Airport
- You should implement a class that maintains instances of the class you constructed in the order reported by compareTo(), in your choice of directions. It should have a toString() method that returns a nicely formatted String with all of the items, in sorted order. An array should be the basis of this class and the size should be settable upon the instance's initialization. You should be able to add (or update) and remove items from this list, while keeping it sparsely packed (no internal holes). You should also be able to find an item's rank.
- You should implement a menu class. Its main method should allow the human user to select to create the collection, add/update an item to the collection, remove an item from the collection, find an items rank, print all items in the collection in sorted order, and to quit.