csci 21 :: programming project 2 (due by 12 noon fri, mar 30)
Submitting your work:

Email the following to me at, with the subject line CSCI 21 Project #2:

  1. all of your source files (do NOT send executables, object files, or catch.hpp)

Create a simple simulation of a vending machine, with a minimum of five (5) products from which to choose. The simulated vending machine should function as follows:

  1. the user is shown a list of products, with inventory counter and credits that each will cost
    • each product should have a counter that tracks how many of that product are left in inventory -- each time the user "buys" one of a product, the counter will go down by one
  2. the user is prompted for a selection, and an appropriate selection is read -- users must be prevented from selecting "sold out" items
  3. the user is prompted to enter payment -- do not let the user proceed until adequate payment (greater than or equal to the amount owed) has been provided
  4. calculate and display the amount of change the customer will receive and "break down" the change to dollars, quarters, dimes, nickels, and pennies (EXAMPLE: "Your change: $0.97 (3 quarters, 2 dimes, 1 nickel, 2 pennies)")
  5. let the user choose to purchase another item or exit the program
    • if the user chooses to keep shopping, loop back to the top of the program and show the user the product selections again (with updated inventory counters)
    • if the user chooses to stop shopping, show them a "receipt" that displays:
      • quantity of each item purchased and total cost of that item
      • total cost of all products purchased

Total points for this programming project:

600 points