Lab 7 - A Simple Inventory

Due - April 5/6, 2004

In this lab, you will write a program that uses arrays. Your program will keep a very basic inventory. For example, you might have an inventory of items sold at a clothing store. Associated with each item (e.g., shirts, pants, sweaters) are two values: the cost and how many of item are currently in the inventory. To keep track of these values, you should keep two parallel arrays. Element 0 of the first array will store the cost of the first item while element 0 of the second array will store how many of the first item are currently in the inventory.

Your program should ask the user to input the cost and number in inventory for each item. The user may enter information for up to 15 items. However, there may be fewer than 15 items in the inventory. Your program should then calculate the total number of pieces in the inventory (for example, if I have two shirts and five sweaters, the total number of pieces would be seven), and the total value of the inventory. The results should be printed for the user.

Your program should then ask the user to enter any changes to the inventory. For example, the user might increase the number of a particular item if a shipment has arrived or decrease the number of a particular item if some have sold. Your program should update the calculations (total items in inventory and total inventory value) and reprint them for the user.

You may design the program however you would like. However, part of your grade will be based on your design. Think carefully about how to break the problem down and how functions can be used. A program with only a main function will receive a low score for design.
  1. Make sure that each function is well documented.
  2. Make sure a lab assistant (Dianne or I) has seen your program run.
  3. Copy and paste the output of your program to the bottom of your program itself. Make sure the output is a comment. That means, put a /* before the output and a */ after the output.

Sami Rollins