Create an application named FirstPlay Sports Rental that keeps track of the inventory for a sports rental store.

Requirements Specification

  • The user can input a new rental item and add it to the store inventory.
  • The user can select an item’s ID Number from a list and remove the item from the inventory.
  • The user can select an item’s ID Number from a list and display the item’s properties.
  • When the application starts, it reads an inventory list from a file (text format).
  • When the application ends, it writes the inventory list back to the same file.

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.

Startup Form

The application’s startup form displays inventory items and lets users carry out each of the following actions:

  • Input fields for a new rental item, and add that item to the inventory.
  • Select an item’s ID Number and remove the item from the inventory.
  • Select an item’s ID Number and display the item’s properties.

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.

Classes

We suggest that the application define three classes: Item, Inventory, and InventoryFile.

  • The Item class encapsulates a single inventory item.
  • The Inventory class represents a collection that contains all items and provides meth- ods for adding, finding, and removing items. Internally, it should hold the items in a Dictionary object.
  • The InventoryFile class is responsible for reading the inventory data from a text file, and writing all Inventory data back to the file.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.