Homework Three

Your assignment is to write a pizza ordering system for the mighty Pizza Yurt chain. You must implement the program using separate functions for each major component of the program. In addition, we will continue using lots of loops and tests.

Your final program should do the following:

  1. User may enter more than one order, one at a time.
  2. Each order may have more than one pizza. Zero pizzas quits.
  3. User selects a size (small, medium, or large) for each pizza.
  4. User selects number of toppings for each pizza
    NOTE: Store the total number of toppings for all pizzas in an order using a single variable.
  5. Program verifies order is correct. If not, user re-enters the order.
  6. Program produces an itemized receipt including tax and total.
    Try to make it neat but don't obsess over aligning the decimal points.
  7. Use global constants for the following values:
    1. a small pizza is $ 5
    2. a medium pizza is $ 7
    3. a large pizza is $ 9
    4. Toppings are $ .75 each
    5. Tax is 10 % of the subtotal.

An important part of this assignment is breaking down the problem into smaller steps and writing a function for each step. Here are examples of possible functions you may want to write:

  1. get_num_pizzas checks to make sure valid number is entered, returns int.
  2. get_pizza_size checks to make sure valid letter is entered, returns char.
  3. print_order shows total small, medium, and large pizzas and total toppings.
  4. print_receipt calculates cost of all items, subtotal, tax, and total.
  5. calc_tax determines the tax given a double and returns a double.

Here is a sample run of the program. The user's input is shown in bold:

Welcome to Pizza Yurt!

This is order 1.
How many pizzas would you like? -3
Please enter a positive number, or 0 to quit.
How many pizzas would you like? 2
What size pizza would you like (S, M, or L) for pizza 1 ? S
How many toppings would you like on pizza 1 ? 4
What size pizza would you like (S, M, or L) for pizza 2 ? X
You may choose from S, M, or L.
What size pizza would you like (S, M, or L) for pizza 2 ? L
How many toppings would you like on pizza 2 ? 2
Your order is:

	1 small pizza
	1 large pizza
	6 toppings

Is this correct? Y
Receipt:
    
    Pizza Yurt
    Order #1
    1 small pizza  $  5.00
    1 large pizza  $  9.00
    6 toppings     $  4.50
        
    subtotal       $ 18.50
    tax            $  1.85
    
    TOTAL          $ 20.35
        
This is order 2

How many pizzas would you like? 0
Thanks for working at Pizza Yurt!

Hand in a printout of your final program and a sample run demonstrating all the features of your program.