You have been hired by the Better Than Average Equipment Company
to help them computerize their inventory control procedures. You
are to write an interactive program to perform inquiries and
reports about their inventory. They desire a menu-driven
application with the ability to load an inventory data file, list
or total the inventory by department, search for an item, and
display reports sorted by different fields.
The data file to be processed contains some arbitrary number of
records, each of which describes an item in the inventory.
Each record is comprised of six fields, in this order:
Catalog Code, Department, Quantity on hand, Item description, Unit
Price, and Reorder date. The layout of each record in the
data file is shown below:
Field Name | Value | Columns |
---|---|---|
Catalog Code | 6 alphanumeric characters | 3 - 8 |
Department Code | One single letter (A - E) | 11 |
Quantity on Hand | an integer (0 - 9999) | 13 - 16 |
Item Description | A string of up to 20 characters with no embedded blanks | 18 - 37 |
Unit Price | An integer representing the price in cents | 38 - 43 |
Reorder Date | A string representing the reorder date coded as dd-mmm-yyyy | 46 - 56 |
This will be an integer from 1 - 5 specifying an action to be taken. (See 3.1 below.)
This will be a single capital letter in the range A - E, or the character * .
This will be the catalog code that a user wants to search for.
The main menu that controls the program contains a title, states the name of the currrent data file, and shows a list of action options and a prompt as shown below:
Better Than Average Equipment Inventory Report Program MENU OPTIONS 1) Load the inventory from a file. 2) Print a list of inventory items. 3) Print total value of merchandise. 4) Search for a particular item. 5) Exit Enter menu choice (1-5):
Enter Department code (A,B,C,D,E, or * = all) :
The list option displays the items in a nicely formatted columnar display. The display should appear in this order: Catalog code, department, part name, quantity, price, reorder date. The output layout should appear as shown below:
Catalog Code Dept Part Name Quantity Unit Price Reorder date CSO842 A AUTOMOBILE 5 69.06 3-Oct-2008 KJX730 A BICYCLE 10 184.10 31-Dec-2007 URM841 A BOAT 3 78.24 20-Oct-2007 KWH629 A SKATEBOARD 10 122.40 4-May-2009 PPC630 A VAN 10 185.10 27-Jul-2010
Here your program is to display a menu of actions which the program can perform as depicted in 3.1
4.2.1 Display a prompt asking the user for the name of the inventory data file.
4.2.2 Assume the file is correctly formatted and read the data.
4.2.3 Display the file name and the number of records read from the file.
File EQUIP07.DAT loaded. 41 records found.
4.3.1 Display a prompt asking the user whether s/he wants all items listed, or just those from a specific department.
4.3.2 If the user enters A - E for a department code, list just the items from that department, ordered by part name.
4.3.3 If the user enters *, list all the items in the inventory, ordered by part name.
4.3.4 Any other input will display the main menu again.
4.4.1 - 4.4.4 Again, user must specify which department (or ALL departments) as in 4.3. If the user enters an invalid department code, a quantity on hand of zero should be displayed.
4.4.5 Compute total value by multiplying unit price by quantity for each item and summing them.
4.4.6 Display the total.
4.5.1 Display a prompt asking the user for the catalog code to search for.
4.5.2 Display the complete record for the target item, using the same display format as in 4.3.
4.5.4 If the search fails, display an informative message.
Terminate the application.
5.1 It is possible that your Load operation will fail.
This will happen if the program cannot find the inventory data
file specified or if the access permissions on the file are
incorrectly set. So have your program print a
helpful error message that explains the problems and suggests
possible corrective action. Then display the main menu.
5.2 If the user's menu choice is not a valid option, display a prompt
Please enter an option between 1 and 5:and allow her/him to reenter her/his selection.