Please find the helper file with detailed description and sample input and output here pancake_helper.pdf
Pearl's Pancake Pad is a growing restaurant business, and they'd like to upgrade their existing pen-and-paper system for tracking tickets to a digital point of sale system. They are asking you to design and build that point of sale program for them.
The point of sale program must:
- Allow the waitstaff to input the table number, and the number of diners at this table. Each table can seat up to 4 diners.
- For each diner, Display a menu of at least 7 common breakfast items, including types of drinks and entrees, with prices displayed. The menu is small, but the quality is high!
- Allow the waitstaff to enter the items the diner has ordered. Each diner may order as many items as they want.
- After all diners at this table have ordered, display the before tax total and total with tax forthe entire table (sales tax is 8%). Also, display the suggested tip amounts for 10%, 15%, 20% and 25% service qualities.
- After a table is complete, the program should restart at the beginning, and continue until the manager selects quit. Before the program exits, it should report the total amount of money that should be in the register (ticket totals + tax for the entire day).
Design Details
Below, you are given some problem analysis and design details. You may find these helpful, and you are free to base your implementation on these details. Note that these details may not be complete. Feel free to add to or make changes to any of these details.
Problem Definition
- Problem Description:
Design a program that will allow a waitperson to take orders for each table, and calculate and display the per-person total, per-table total, recommended tip amounts,and overall daily total.
- List of Program Inputs:Table number
- Number of diners at table
- Menu item ordered by a diner
- List of Program Outputs:Menu of food items
- Before tax total for a table of diners
- After tax total for a table of diners
- Suggested tip amounts for a table
- After tax grand total for the day
Algorithm Outline
For each table of customers
Get the table number
Get the number of diners at this table
For each diner at this table
Display menu of food items
Get items ordered by this diner
Calculate before tax total of this diner's order
Calculate before tax total for the table
Calculate after tax total for this table
Calculate the suggested tip amounts for this table
Display the after tax total for this table
Display the suggested tip amounts for this table and the grand total for the table
Display the total sales (after tax) for the day
Structure Summary
- Functions: List of Functions (with name, parameters, and return value description): Name: get_table_number
Parameters:
Returns: a table number (as an int)
Description: Prompts user to enter a table number; collects and returns the user's input (as an int).
- Name: get_number_of_diners_at_table
Parameters:
Returns: the number of diners at this table (as an int)
Description: Prompts user to enter the number of diners at this table; collects and returns the user's input (as an int).
Parameters:
Returns: total for the table
Description: calls get_diner_order for each diner at this table; calls calculate_table_total by passing the total of all diners (total of table) before tax; calls display_diners_totals; calls display_table_total_info; Computes and returns the after tax total for the whole table.
Parameters:
Returns: before tax total for diner
Description: Calls display_menu_of_food_items, and then calls get_menu_item as many times as needed to collect the items ordered by this diner while accumulating the total of the item prices; Returns the before tax total for the diners.
- Name: display_menu_of_food_items
Parameters:
Returns:
Description: displays the menu of available food items
Parameters:
Returns: menu item number
Description: Prompts the user to enter a food item number from the menu; collects and returns the item number the diner is ordering.
- Name: display_diners_totals
Parameters:
Returns:
Description: Displays the before and after tax totals for each diner at this table.
- Name: calculate_table_total
Parameters: table total before tax
Returns: after tax total for table
Description: Calculates and returns the after tax total for the table. Use sales tax = 8%
- Name: display_table_total_info
Parameters: table total after tax
Returns:
Description: Displays the list of suggested tip amounts based on the input table total value. Prompts the user to enter the tip amount, collects it and adds it to the table total after tax. Display the grand_total amount after adding the total with tip amount. Returns the grand total.
Parameters:
Returns:
Description: Repeatedly calls get_table_number, get_number_of_diners_at_table and get_table_order until the user reports that there are no more tables for today, while accumulating the total sales for the day; then outputs the total sales for the day.
Function Implementation
Breaking a program down into a set of simple functions that each do one thing that the program needs to do, can be very helpful. Here are some ideas for functions that might be helpful in completing this assignment.
Design a function named get_table_number, that will take no arguments and will return an int value indicating the table number. When called, this function will ask the user What is the table number, collect it using (input()) and return that value as
an int.
Design a function named get_number_of_diners_at_table, that will take no arguments and will return an int value indicating the number of diners at this table. When called, this function will ask the user how many diners are at this table (1-4), and collect and return that value as an int.
Design a function named display_menu_of_food_items, that will display the following menu of numbered (1 - 7) choices when called. This function should take no arguments and should return no value.
For example, display_menu_of_food_items () should print out the following:
1) eggs 2) bacon 3) pancakes 4) orange juice $1.25 $3.25 $4.00 $2.50 5) oatmeal 6) milk 7) donut $3.99 $1.25 $2.00
Design and write a function named get_menu_item. This function should take no arguments and should return an int value. When called, this will prompt the user to enter a menu item number, collect it and return the user's choice.
Design and write a function named get_diner_order. This function should take no arguments and should return a float value (the total cost of this diner's order). When called, this function should first display the menu by calling
the display_menu_of_food_items () function. Then the function should continue to ask if this diner would like to order another menu item prompting the user to enter 'y' if they wish order another item else enter 'n' - collecting the total cost of all items ordered by this diner - until the diner does not want any more menu items. Use the get_menu_item function to get each menu item ordered by this diner and use a set of if conditions (if_else ladder) to check the item entered and assign the corresponding value to price.
At the end of if-else ladder add the price to total_cost (Refer snippet below). Return this total_cost. Here is an outline of this function for you to follow and fill in.
def get_diner_order(): total_cost = 0.0
while input('Do you want to order an item? Answer y or n') == 'y':
price = [Hint: use if-else ladder]
return total_cost
Design a function named calculate_table_total. This function should take table total before tax and should return a float value. When called, this will calculate the table total after tax using %8 sales tax value and returns it.
Design a function named display_diners_totals. This function takes 2 values: table total before tax and table total after tax and returns nothing. When called, this will display the two values passed to the function.
Design a function named display_table_total_info. This function should take a float argument indicating a table total value after tax and should return a float value. When called, this function should display a list of tip amounts for 10%, 15%, 20%, and 25% tip rates based on the input cost value passed in as an argument. Prompt the user to enter one of the displayed tip amounts. Collect it and add it to the total cost after tax. Display the grand total and return this new grand total.
For example, display_table_total_info(12.95) should print out something like this:
10% tip: 1.30 15% tip: 1.94 20% tip: 2.59 25% tip: 3.24
Design a function named get_table_order. This function takes 1 value: the number of diners at the table and returns a float value. When called, this will loop over the number of diners and call get_diner_order() function and keeps adding the value returned by it to the total table value. Next it calls calculate_table_total() ; display_diners_totals() and display_table_total_info(). Here is an outline of this function for you to follow and fill in.
def get_table_order(num_diners): table_total_before_tax = 0.0
while diner <= num_diners:
return grand_total
Following is the input and output sample of a run:
There are 3 Steps involved in it
Step: 1
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started