Create an application named FirstPlay Sports Rental that keeps track of the inventory for a sports rental store.
User Interface Details
Display a single sports rental item in a window, as shown in Figure 3-23. Each item has an ID number; a description; daily, weekly, and monthly rental rates; and the quantity on hand. When the application starts, it reads all item information from a file into a col- lection (implemented as a Dictionary) and copies the item ID numbers into a combo box on the form. The user can select an ID number from the combo box, and display or remove existing items. The user can also add new items to the collection. When the pro- gram ends, it writes the collection to the same file. See image.
The application’s startup form displays inventory items and lets users carry out each of the following actions:
When the form loads, the combo box should contain a list of all inventory ID Numbers.
Returning to Figure 3-23 for a moment, we see that it shows a new item about to be added to the store inventory. When the Add Current Item button is clicked, the button’s handler cre- ates a new Item object and passes it to the class that handles the store inventory. Figure 3-24 shows an example of searching for an item by ID Number. When the user clicks the Display Item button, the remaining item fields are filled in. When the user clicks the Remove Current Item button, the program confirms the operation with the user, as shown in Figure 3-25. If the answer is yes, the program removes the item identified by the ID Number. See image.
We suggest that the application define three classes: Item, Inventory, and InventoryFile.