Project 2
Pizza
Posted:
| Monday 9/23/02
|
Design Document Due:
| before midnight, Sunday 9/29/02
|
Project Due:
| Before midnight, Sunday 10/6/02
|
Notes
| 02 Oct 02
For Mr. Raouf's sections only -- Mr. Raouf is offering
10 points extra credit for those students who validate the user's
telephone number. The accepted format of the phone number is
(999) 999-9999.
30 Sept 02
If you overload the input operator ( operator>> ) for both
the Order and Pizza classes, then it is not necessary to provide
mutators unless you need them for some other functionality.
24 Sept 02
For simplicity, the phone number should be considered a string
Please follow the order specified in the sample run for user input. I.e.
input name first, then phone number, then sodas, etc. This will help us
aoutmate the testing of your project.
23 Sept 02
It is permissible for the user to request the same topping more than once
for a single pizza. I.e. Small Pizza with onion, onion and onion is okay
|
Objectives
- To become familiar with C++ class syntax and coding standards
- To implement and use C++ objects
- To reinforce the concept of aggregation
- To use operator overloading for output
- To practice neatly formtted output
- To further practice the use of make files
Project Description
Pizza is a staple of every college student's diet. They eat pizza for
lunch, dinner and late night snack. They even eat it cold for breakfast.
They eat plain, with pepperoni or with every possible topping. They
eat large pizzas, small pizzas and medium pizzas.
In this project, you will simulate the user callling to order a pizza at
the UMBC take-out pizza shop. You will prompt the user for identification
(name and phone number), the items he wishes to order (soda, breadsticks
and pizza), and the size and toppings for each pizza ordered. There is
a maximum of 5 pizzas per order and 3 toppings per pizza.
After the ordering is complete, you will calculate the price of the
order and neatly display the price along with the user indentification
and order information.
Futher Specification
- The UMBC Pizza Take-Out Shop does not collect tax
- There is no delivery fee.
- You may assume that all user input (except for name) is lower case.
- If the user asks for 1 or more pizzas, you must ask the user
if he wishes to see a list of toppings. Acceptable answers are "yes"
and "no", not "y" and "n".
- All items must be listed on the order, even if none are purchased.
UMBC Pizza Take-Out Price List
Item | Price
|
---|
2-Liter Soda | $1.19
|
Breadsticks | $0.99
|
Plain Small Pizza | $4.99
|
Plain Medium Pizza | $6.99
|
Plain Large Pizza | $9.99
|
Pizza Toppings
| $0.79 each on Small Pizza
$0.99 each on Medium Pizza
$1.29 each on Large Pizza
|
Pizza Toppings Available
Pizza Toppings
|
---|
pepperoni
|
mushrooms
|
sausage
|
anchovies
|
onions
|
green pepper
|
Project classes
This project will require you design and implement two C++ classes
as described below. Be sure to consider the OOP principles of
encapsulation and data hiding when designing and implementing these
classes.
The Order Class
This class maintains all the information for an order.
- The user's name
- The user's phone number
- The number of 2-Liter sodas ordered
- The number of breadsticks ordered
- The number of pizzas ordered
- Information about each pizza (max of 5)
This class provides the following functionality
- A default constructor. You may create as many other constructors
as you deem necessary
- Mutators for each item stored in the order
- Calculates the total cost of the order
- The overloaded output operator for displaying all order details
The Pizza Class
This class maintains all information about a pizza
This class provides the following functionality
- A default constructor. You may create as many other constructors
as you deem necessary
- Calculates its own cost
- The overloaded output operator for displaying the pizza details
Sample Run
This output was generated by hand, not by any program. That means
that there may be typos, addition mistakes and/or other inconsistencies.
Your output does not need to look exactly like this, but be
neatly formatted to be easily readable and must contain all
required information
[linux2] Proj2
Welcome to the UMBC Pizza Shop
Please enter your name: Bob Smith
Please enter your phone number: 410-555-4432
How many 2-liter sodas would you like? 2
How many breadsticks would you like? 0
How many pizzas would you like? 7
Sorry, but there is a maximum of 5 pizzas per order
How many pizzas would you like? 2
Would you like to see a list of toppings? yes
pepperoni
mushrooms
sausage
anchovies
onions
green pepper
What size for pizza #1? small
How many toppings would you like for pizza #1? 5
Sorry, but there is a maximum of 3 toppings per pizza
How many toppings would you like for pizza #1? 3
Please enter a topping: pepperoni
Please enter a topping: garlic
Sorry, we don't offer garlic, please enter another topping
Please enter a topping: mushrooms
Please enter a topping: onions
What size for pizza #2? large
How many toppings would you like for pizza #2? 2
Please enter a topping: anchovies
Please enter a topping: onions
Your order details:
UMBC Pizza Take-Out Shop
Ordered by: Bob Smith
Phone: 410-555-4432
Item Quantity Cost
---- -------- ----
Soda 2 $ 2.38
BreadSticks 0 $ 0.00
Small Pizza $ 7.36
pepperoni, mushrooms, onions
Large Pizza $12.57
onions, anchovies
Total Cost: $22.31
Thanks for calling UMBC Pizza Take-Out!
Have a nice day!
Design Assignment
Your design assignment must specify the class interface for all
classes in the project (essentially your .H files), including the
signatures of all methods and the declarations of all private data.
Your design assignment must also specify your basic algorithm.
Error Handling
You must validate all user input. If you detect invalid input,
output a meaningful error message and reprompt for the input.
Project Make File
You are required to submit a make file with this project. The grader should
simply need to type "make Proj2" and your project should compile and link to an
executable called Proj2. The grader should also have the ability to do a
"make clean" and "make cleanest." Hint:Start with the makefile from project 1 and modify it.
See the 202 Syllabus
for links to more information on make files.
Grading
The grade for this project will be broken down as follows:
- 70% - Correctness
- The program behaves the same way that the sample does and the code meets ALL of the
project specification.
- 10% - Design
- Your design was submitted on time.
- Your design must provide a complete user interface for each class.
- 20% - CMSC 202 Coding Standards and Documentation
- Extra Credit - 10 points
- For 10 points of extra credit (all or nothing), sort the pizzas
which are displayed in the order. Pizzas should be sorted by size
(small, medium, large). If there is more than one pizza of the same
size, sort them by number of toppings.
Project Submission
You must use separate compilation for this project. You should submit
the following files:
- Your source code. See CMSC 202 OOP coding standards for details on file organization and implementing classes.
- Makefile (or makefile) - the make file that builds the Proj2 executable
Submit as follows:
submit cs202 Proj2
The order in which the files are listed doesn't matter.
You can check to see what files you have submitted by typing
submitls cs202 Proj2
More complete documentation for submit and related commands can be found
here.
Remember -- if you make any change to your program, no matter how
insignificant it may seem, you should recompile and retest your program before
submitting it. Even the smallest typo can cause compiler errors and a reduction
in your grade.