CpSc 146 Function Assignment Overview
Due Dates: See below
60 points
This assignment is to simulate the operation of a vending machine. It is to maintain its own internal cash register as well as dispense food, accept payment, and give change.

The vending machine dispenses:

  1. Potato Chips for $1.00
  2. Chewing gum for $0.55
  3. Cheese Curls for $0.80
  4. Pretzels for $0.75
  5. Chocolate Chip Cookies for $1.50
  6. Candy Bars for $1.00

The program is to show the products sold by the vending machine, give directions on how to select a product and how to terminate.
When a product is selected, the user enters the amount coin-by-coin.
When the program terminates, the amount left in the machine is to be displayed.

Your program must contain:

As you read this assignment you should have lots of questions that are not answered by this web page. This is intentional so that you encounter places where you must make design decisions. After part two's due date, more details will be provided.


Part 1: Design
Due: Nov 9th
0 or -5 points

Design the program by creating an outline or flowchart. Problem decomposition will result in a list of the main pieces of the solution. Describe how data flows from one piece to the next.


Part 2: Specification for 4 functions
Due: Nov 11th
0 or -5 points

You are to write two specifications and your partner is to write the other two specifications. The specifications must include:

Note functions are not permitted to use global variables, but may use global constants.

Part 3: Code for 2 functions and main program to test individual functions
Due: Nov 14th or 16th
10 points

You are to work together writing the code for a single function and a main function to test it. This single function is the function that collects the money input by the user.
Two members should next be assigned different functions to write: calculate change, and determine cost of purchase.
The third member is to write a test harness for each of these functions.
So, three separate programs will be handed in. Each program will contain ONE of the functions and the test harness (i.e., main).


Part 4: Completed Project
Due: Nov 28th
Place the .cpp in the Dropbox on D2L. Also place sample runs that exhibit the input you expect the user to provide, how to exit any menu, and how to get the end of the day report