CS 210 - Fundamentals of Programming I

Spring 2006 - Programming Project 1, Part A

30 points

Out: February 16, 2006
Due: February 23, 2006


Reminder: Programming projects are larger programs that use multiple techniques that we have studied, therefore they contribute a much higher percentage of the final grade than programming assignments.


Part A of this first programming project consists of analyzing and designing a program for the problem statement given below. The analysis and design must be entirely your own work, except for any help you may get from the instructor. Hand in a clean, readable copy of your analysis and design to the instructor by 5pm on Thursday, February 23.


Part B of this project will be to implement your program with certain implementation criteria. This portion will be handed out on Thursday, February 23, and will be due the Thursday after spring break, March 16.

Problem Statement

A soft drink distributor asks you to write a menu-driven program to keep track of their inventory of cases of soft drinks. The distributor sells the following brands with the indicated product codes:

Brand Product Code
Coca-Cola 1
Pepsi 2
Canada Dry 3
7Up 4
A&W 5
The program should begin by reading in the inventory for each brand at the start of the week, process all sales and purchases for each brand, and print out the inventory. The program should allow the user to purchase soda, sell soda, and display inventory. It should allow the user to repeat these actions until the user wants to quit. When the program ends, it should display the final inventory.

Design Criteria

The program should have (at least) the following components:


Your design should consist of analyses and designs for the main program and any functions you use. The action taken for each choice in the menu (i.e., purchase, sell, display) must be designed as a function. Other parts of your program may also be designed as functions. The goal is to produce a modular design where each function is understandable in its own right.

Example program run

Welcome to the Evansville Distributorship Inventory Program.

This program keeps track of soft drink inventories.  Please enter the
beginning inventory for the following brands:
Coca-Cola: 20
Pepsi: 30
Canada Dry: 10
7Up: 10
A&W: 5

You may choose an action from the following menu:

   P: Purchase soda
   S: Sell soda
   D: Display inventory

What is your selection?: D

Soda         Cases
------------------
Coca-Cola      20
Pepsi          30
Canada Dry     10
7Up            10
A&W             5

Do you want to do another action? (y/n): y

You may choose from the following menu:

   P: Purchase soda
   S: Sell soda
   D: Display inventory

What is your selection?: P

You may choose from the following soda brands:

   1: Coca-Cola
   2: Pepsi
   3: Canada Dry
   4: 7Up
   5: A&W

Please enter the code for the soda you are purchasing: 1

Please enter the number of cases purchased: 10

10 cases of Coca-Cola have been added into the inventory

Do you want to do another action? (y/n): n

The final inventory is:

Soda         Cases
------------------
Coca-Cola      30
Pepsi          30
Canada Dry     10
7Up            10
A&W             5

Have a good day!


Converted using latex2html on Wed Feb 15 21:56:49 CST 2006