## CS 2401 Assignment #5

Due Date: Wednesday, Oct 13, 2010, or Thursday, Oct 14, 2010, depending on the day of your lab.

Objective: The goal of this assignment is to practice the use of vectors and enumeration.

Motivation: A local restaurant needs a system to help track the orders for their customers, and to determine the most popular dishes. Your system will keep track of what people are ordering and help to analyze the data.

Menu Items. The first thing you will need is a data structure to represent each menu item: "Soda", "Pizza", and "Ice Cream". You must use an enumeration data type to represent the three possible options. In addition, your enumeration type should store the price for each item. Soda is 1.50, pizza is 3.00, and ice cream is 2.25.

Orders. For convenience, you should create a simple class called "Order" to represent each individual order, including the quantity ordered and the type of food ordered. Each order has only one type of food.

Cash Register. The cash register class will keep track of all of the orders placed. The class MUST use a vector to store a list of Order objects. There should be a function called "addOrder" that will create a new order and add it to the vector. In addition, the cash register must implement several methods to support analysis of the data:

• Compute the total amount paid for all orders
• Compute the total number of items ordered (i.e., number of sodas plus number of pizzas plus number of ice creams)
• Compute the total number of items ordered for each individual food type, where the type is passed as a parameter to the method
• Compute the average selling price (total amount paid / total number of items ordered)

Your program will first read in orders entered by the user on the console. First, the program should prompt the user to select a type of food, as shown below. Then, it should prompt for the quantity to order. This continues until the user enters "3" to stop ordering.

```
Please select a type of food to order.

enter 0 for "Soda"

enter 1 for "Pizza"

enter 2 for "Ice Cream"

enter 3 to stop placing orders

Selection:

```

then if the users has entered 0, 1, or 2

```
Enter quantity:

```

Finally, after the user has stopped entering orders the program should print analysis of the data, including:

• The total number of orders
• The total number of items ordered for all three types of food
• The total number of items ordered for each individual type of food
• The total price paid by customers
• The average selling price