The Assignment
This assignment asks you to simulate a "Show and Sale", where the Collectors exhibit their Collectables as well as buy and sell Collectables from each other.You should simulate this event by allowing the user to read in as many CollectionLists as they'd like.
Then, you should allow the user to simulate the event. This method causes collectors to buy and sell from each other, according to their own buy and sell rules for each Collectable. Once this method executes, you should allow the user to select a collector and display two things:
- The net amount of money spent or collected during the show
- The collection after the show.
Implementation Suggestions
You can solve this problem however you'd like. But, we'd like to make some suggestions. Specifically, we'd like to suggest creating a ShowAndSale class and a Menu class. The Menu class should be pretty straight-forward -- it is the class with that exhibits the menu and has the main() method.The ShowAndSale class will likely be very rich. We'd like to suggest the following components and algorithms:
- An ArrayList, with each entry representing a particular collectors collection (CollectableList).
- Augment the Collectable to include a reference back to the owner (or the CollectableList).
- An ArrayList, which lists each item by unique name, and then selling price
- An ArrayList, which lists each item by unique name, and then buying price
- Go through and sell items to the highest bidder bidder that satisfies the seller's minimum price (reserve), split any surplus (difference between minimum sell and maximum buy). And keep track of the net movement of money.
- Just start at the top of the seller's list, and walk down, and then walk down the buyer's list, until you have sold the item to the highest bidder, or there are no bidders. Sell each unit, within a single collection, then move to the next one.
- You might want to create an Owner class that contains an owner's name, balance, and CollectableList. If you do this, the owner's name should be the first line in the input file.