1. Engineering
  2. Computer Science
  3. programming language is python pearls pancake pad is a growing...

Question: programming language is python pearls pancake pad is a growing...

Question details

Programming Language is Python

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 for each individual diner (sales tax is 8%). Also, display the total with tax for the whole table, and 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 and write 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 diner
    • After tax total for a diner
    • 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 and display before and after tax totals for each diner at this 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

    Display the grand total (after tax) for the day

    Structure Summary

  • Functions: List of Functions (with name, parameters, and return value description):
    • Name: get_table_number
  • Parameters: <none>

    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: <none>

    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).

    • Name: get_table_order
  • Parameters: <none>

    Returns: total for the table

    Description: calls get_diner_order for each diner at this table; Computes and returns the after tax total for the whole table.

    • Name: get_diner_order
  • Parameters: <none>

    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 this diner.

    • Name: display_menu_of_food_items
  • Parameters: <none>

    Returns: <nothing>

    Description: displays the menu of available food items

    • Name: get_menu_item
  • Parameters: <none>

    Returns: total for the table

    Description: Prompts the user to enter a food item from the menu; collects and returns the item the diner is ordering.

    • Name: display_diners_totals
  • Parameters: total_diner_1, total_diner_2, total_diner_3, total_diner_4

    Returns: <nothing>

    Description: Displays the before and after tax totals for each diner at this table.

    • Name: calculate_table_total
  • Parameters: total_diner_1, total_diner_2, total_diner_3, total_diner_4

    Returns: after tax total for table

    Description: Calculates and returns the after tax total for the table.

    • Name: display_table_total_info
  • Parameters: table_total

    Returns: <nothing>

    Description: Displays the after tax total for this table, and displays suggested tip amounts.

    • Name: main_program
  • Parameters: <none>

    Returns: <nothing>

    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.

    Call Graph - the graph below shows a visual representation of which functions call which other functions based on the structure summary above

main_program get table_number get_ number_of_diners_at_table get table order get_diner_order display_menu_of_ food_items get_menu_item calculate_table_total display_diners_totals >display table_total_info

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution