csci 20 :: programming project 3 (due by midnight on friday, apr 29)
Submitting your work:

Complete this exercise on your own.

Solve the problem described below by designing, implementing, and testing a C++ console application.

Email your source file (main.cpp if you are using Code::Blocks) to the instructor at jboydt@foobt.net before the deadline.

Description:

You MUST use CinReader (CinReader.h and CinReader.cpp).

View a sample of the running program by downloading and running the example (Windows; Mac).

The purpose of this project is to give you an opportunity to continue practicing creating classes and using objects, and to implement a class that manages an array of objects.

For this project, you will implement a simple simulation of a coffee shop with the following:

The simulation will work as follows:

  1. create two Baristas -- allow the user to specify the maximum number of customers that can "line up" in each Barista line
  2. use a for loop to represent time (each pass of the for loop represents the passage of one minute of time) -- allow your user to input the desired "time"
  3. each "minute", there is a 95% chance that a new customer will arrive; when a customer "arrives", randomly generate the type of customer:
    • 50% of customers will order "drip coffee" (timeToServe: 3, giveUpTime: 4)
    • 35% of customers will order "specialty coffee" (timeToServe: 5, giveUpTime: 6)
    • 15% of customers will order "coffee and food" (timeToServe: 7, giveUpTime: 8)
  4. after randomly generating the customer, place the customer in a Barista line; if one line is "full", place the customer in the other line; if both lines are full, the customer "leaves" -- keep a count of the number of customers who "leave" without being serviced
  5. each minute, check the two Barista lines -- remove any customers in the front of the line whose service is completed (keep a count of the number of customers who are successfully serviced)
  6. each minute, check the two Barista lines -- remove any customers whose "give up" time has been reached (keep a count of the number of customers who "give up")
  7. at the end of the simulation, display a report with the following:
    • the number of "minutes" that the simulation ran
    • the number of customers successfully serviced
    • the number of customers who left (because the lines were full)
    • the number of customers who "gave up" while standing in line
    • the number of customers still waiting in line
  8. EXTRA CREDIT (10 points each) -- in your final report display:
    • the number of "drip coffee" customers who arrived
    • the number of "specialty coffee" customers who arrived
    • the number of "coffee and food" customers who arrived
    • the number of "drip coffee" customers who were successfully serviced
    • the number of "specialty coffee" customers who who were successfully serviced
    • the number of "coffee and food" customers who who were successfully serviced
Objectives:
Requirements:
Total points for this programming project:

500 points