Confidential Teaching Materials
Homework 7 Criteria, Page 1 of 8
Homework 7 Grading Criteria
Note: To receive any credit whatsoever, your answers must be legible and readily readable in the
judgment of the grader. Add brief explanatory comments as necessary to make sure your answers
are clear and unambiguous to the grader.
You have been hired to write a system to keep track of inventory in a major department store. The
specifications for the project state that you must use an object-oriented approach, so all data must be stored
using objects (as opposed to something like records).
Each item in the store has the following information associated with it:
* UPC number (a unique numeric code that identifies the item)
* Description
* Quantity available
* Price each
The store wishes to have the following functionality for the inventory control system:
1. Add an item – asks the user for all of the information about an item, then adds the new item to the
database. When a new item is added to the database, it’s quantity available field should be set to 0.
2. Check availability – given a UPC number, searches the database and prints out all information about an
item. If the item is not present in the database, the system should print “Item not found!”
3. Discontinue item – removes an item from the database given it’s UPC number. If there is no item in the
database associated with the given UPC number, the system should print “Item not found!”
4. Sell item – given a UPC number, searches the database for the given item and decrements it’s quantity
5. Stock item – given a UPC number, searches the database for the given item and increments its quantity
The client has also given you a Dictionary class that you can use for the item database (see description following
Problem 3, below).
[p1] 40 points
Write a class that represents a single item in the store’s inventory. The class should provide the following
abilities:
* Get and set UPC number
* Get and set description
* Get and set quantity available
* Get and set price each
* Increment quantity available
* Decrement quantity available
All data in the class should be stored in the protected section, with appropriate accessor functions to manipulate
it.
[c1] 40 points