CSC133 Introduction to CS Using C++
Lab 9
Write a program to maintain the inventory for amazoon.com, a start
up web site that sells books, CDs, and DVDs. Right now, amazoon.com only has
five items available, because the warehouse is in the CEO's garage.
They hope to add more items as venture capital
becomes available. The five items stocked by amazoon.com are:
item item code initial inventory
Some Devil, Dave Mattews 351 100
War and Peace, Leo Tolstoy 904 200
Jet Li's Fearless 776 300
Feels Like Home, Norah Jones 820 500
The DaVinci Code, Dan Brown 502 250
Your program will do the following:
- Present a menu to the inventory clerk and read the
command entered by the clerk. This menu will
allow the clerk to record when items are shipped or
received. It will also allow the clerk to print the inventory,
and to exit the program.
- Process the command entered by the inventory clerk.
- The program will continue to present the menu and process
commands until the clerk enters the command to exit the
program.
The menu presented by the program should resemble the following:
Amazoon.com Inventory Control
Enter one of the following commands:
Receive items: r
Ship items: s
Print inventory: p
Exit program: e
Enter command ==>
The commands should be processed as follows:
- Receive: This command is used when a shipment of items
is received at the warehouse. Prompt the clerk for the item code
and the
number of items received. Add the number of items received to
the current inventory for the given item.
- Ship: This command is used when items are shipped out to
a customer. Prompt the clerk for the item code and the
number of items shipped. Subtract the number of items shipped
from the current inventory for the given item. If there aren't
enough items to ship, print an error message and do not
subtract anything from the inventory.
- If the clerk enters an invalid item code for the ship or
receive command, print an error message and reprompt for the item
code. Repeat this until a valid
item code is entered. Then complete the ship or receive
command.
- Print: Print the current inventory for all five items.
- Exit: Exit from the program.
- After the command is processed, present the menu again, and
continue until the clerk enters the command to exit the
program. If an invalid command is entered, print an error message
and reprompt.
Use functions and parameters in your program. Try to make your
main an outline of the program, with a function for each major
part of the processing. Spend some time planning what functions you
will use and what each function will do before you start writing
your program. You may use global
constants but do not use any global variables.
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002