g
CIS 125 Principles of Programming Logic Final Exam Restaurant Register Directions Complete the following Python program worth a total of 200 points (20% of the course grade). Name the file restaurant_(your last name).py Academic Honestly Policy Students are expected to uphold the school’s standard of conduct relating to academic honesty. It is imperative that standards of academic integrity be upheld for the best interest of the student, college, community, and industry. Therefore, any instances of academic dishonesty/cheating (receiving or giving assistance to classmates or any live person) will result in an immediate submission of a failing course grade to the college records system. Violations resulting in a failing grade for the course will be forwarded to the Office of the Registrar. Program Specifications/Requirements. • Create a Python program that simulates a restaurant check-out register. • Using a user-defined function, display the restaurant menu and prices exactly like this (minor spaces do not matter, but display in three columns with these menu items and prices): Restaurant Register Dish No. Dish Name Price --------- --------------- -------- 1 Gang Gai $10.00 2 Pad Thai $8.75 3 Pad Cashew $9.50 4 Pad Prik $10.25 5 Peanut Curry $9.50 6 Curry Noodle $11.25 Enter the item number you want (1-6): • Ask the user for the menu item number they want to purchase and validate it to ensure it is: o Between 1 and 6. o Display an appropriate error message if the customer (user) input is not between 1 and 6 and then re-prompt the customer for the input until it is valid, i.e. between 1 through 6. (Note: even though the sample output has the program able to tell the difference between input types, ie a string instead of an int or float, please ignore. Assume that the user will always enter the correct data type at the least. Make sure that the user enters a VALID number.) o See sample runs below. o Accumulate the selected item price into a total order amount. • Once the program has the customer’s menu item number, allow the customer to get a senior citizen discount if they are 65 years old or older. o If the customer is 65 years old or older, give the customer (on that one specific menu item) a 10% discount (i.e. not the entire order if multiple items ordered by others < 65 years old). o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o see sample runs below. o extra credit (+10 points): utilize a user-defined function for this functionality (see grading rubric below). • next, ask the customer if they would like to order another item. o if they indicate yes, repeat the steps above, i.e. re-display the menu, get user input, etc. o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o thus, the menu and this user input will be in a loop. • once the customer indicates they do not want to order another item, then proceed to these next steps. • extra credit (+10 points): o using a user-defined function, apply a 5% discount to the bill if the current day/time is monday from 11 am to 2:59 pm i.e. a monday lunch special. • apply 6% taxes to the bill. o see sample runs below. • ask the customer if they have a gift card they want to use. o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o if yes, ask them how much money they would like apply towards the bill. o validate/ensure this amount is not greater than the bill amount (i.e. you can’t apply more gift card money than the bill is for). display an appropriate error message and re-prompt the customer until valid input is entered. o reduce the bill amount by the valid gift card amount indicated by the customer. o see sample runs below. • display the final bill information as shown in the sample runs below. • ensure your program is well-documented throughout with informative comments/remarks. sample program run #1 (one purchase with no specials) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 7 invalid item choice. enter valid item number (1-6): 1 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? n do you have a gift card (y or n)? n bill information --------------------------------------------------- total of all items: $10.00 taxes: +$0.60 ------- bill: $10.60 sample program run #2 (one purchases with senior special and gift card) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? y would you like to order another item (y or n)? n do you have a gift card (y or n)? y how much money would you like to apply from card?3 bill information --------------------------------------------------- total of all items: $10.00 total senior discounts: -$1.00 taxes: +$0.54 gift card amount applied: $-3.00 ------- bill: $6.54 sample program run #3 (one purchases with lunch special) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? n do you have a gift card (y or n)? n bill information --------------------------------------------------- total of all items: $10.00 total of all items: $10.00 lunch special discount: -$0.50 taxes: +$0.57 ------- bill: $10.07 sample program run #4 (two purchases with lunch special, senior special and gift card) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? d invalid choice. are you 65 years old or older (y or n)? y would you like to order another item (y or n)? y restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 2 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? b invalid choice. would you like to order another item (y or n)? n 65="" years="" old).="" o="" validate="" this="" user="" input="" (i.e.="" yes/no).="" display="" an="" appropriate="" error="" message="" and="" re-prompt="" the="" customer="" until="" valid="" input="" is="" entered.="" o="" see="" sample="" runs="" below.="" o="" extra="" credit="" (+10="" points):="" utilize="" a="" user-defined="" function="" for="" this="" functionality="" (see="" grading="" rubric="" below).="" •="" next,="" ask="" the="" customer="" if="" they="" would="" like="" to="" order="" another="" item.="" o="" if="" they="" indicate="" yes,="" repeat="" the="" steps="" above,="" i.e.="" re-display="" the="" menu,="" get="" user="" input,="" etc.="" o="" validate="" this="" user="" input="" (i.e.="" yes/no).="" display="" an="" appropriate="" error="" message="" and="" re-prompt="" the="" customer="" until="" valid="" input="" is="" entered.="" o="" thus,="" the="" menu="" and="" this="" user="" input="" will="" be="" in="" a="" loop.="" •="" once="" the="" customer="" indicates="" they="" do="" not="" want="" to="" order="" another="" item,="" then="" proceed="" to="" these="" next="" steps.="" •="" extra="" credit="" (+10="" points):="" o="" using="" a="" user-defined="" function,="" apply="" a="" 5%="" discount="" to="" the="" bill="" if="" the="" current="" day/time="" is="" monday="" from="" 11="" am="" to="" 2:59="" pm="" i.e.="" a="" monday="" lunch="" special.="" •="" apply="" 6%="" taxes="" to="" the="" bill.="" o="" see="" sample="" runs="" below.="" •="" ask="" the="" customer="" if="" they="" have="" a="" gift="" card="" they="" want="" to="" use.="" o="" validate="" this="" user="" input="" (i.e.="" yes/no).="" display="" an="" appropriate="" error="" message="" and="" re-prompt="" the="" customer="" until="" valid="" input="" is="" entered.="" o="" if="" yes,="" ask="" them="" how="" much="" money="" they="" would="" like="" apply="" towards="" the="" bill.="" o="" validate/ensure="" this="" amount="" is="" not="" greater="" than="" the="" bill="" amount="" (i.e.="" you="" can’t="" apply="" more="" gift="" card="" money="" than="" the="" bill="" is="" for).="" display="" an="" appropriate="" error="" message="" and="" re-prompt="" the="" customer="" until="" valid="" input="" is="" entered.="" o="" reduce="" the="" bill="" amount="" by="" the="" valid="" gift="" card="" amount="" indicated="" by="" the="" customer.="" o="" see="" sample="" runs="" below.="" •="" display="" the="" final="" bill="" information="" as="" shown="" in="" the="" sample="" runs="" below.="" •="" ensure="" your="" program="" is="" well-documented="" throughout="" with="" informative="" comments/remarks.="" sample="" program="" run="" #1="" (one="" purchase="" with="" no="" specials)="" restaurant="" register="" dish="" no.="" dish="" name="" price="" ---------="" ---------------="" --------="" 1="" gang="" gai="" $10.00="" 2="" pad="" thai="" $8.75="" 3="" pad="" cashew="" $9.50="" 4="" pad="" prik="" $10.25="" 5="" peanut="" curry="" $9.50="" 6="" curry="" noodle="" $11.25="" enter="" the="" item="" number="" you="" want="" (1-6):="" 7="" invalid="" item="" choice.="" enter="" valid="" item="" number="" (1-6):="" 1="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" n="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?="" n="" do="" you="" have="" a="" gift="" card="" (y="" or="" n)?="" n="" bill="" information="" ---------------------------------------------------="" total="" of="" all="" items:="" $10.00="" taxes:="" +$0.60="" -------="" bill:="" $10.60="" sample="" program="" run="" #2="" (one="" purchases="" with="" senior="" special="" and="" gift="" card)="" restaurant="" register="" dish="" no.="" dish="" name="" price="" ---------="" ---------------="" --------="" 1="" gang="" gai="" $10.00="" 2="" pad="" thai="" $8.75="" 3="" pad="" cashew="" $9.50="" 4="" pad="" prik="" $10.25="" 5="" peanut="" curry="" $9.50="" 6="" curry="" noodle="" $11.25="" enter="" the="" item="" number="" you="" want="" (1-6):="" 1="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" y="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?="" n="" do="" you="" have="" a="" gift="" card="" (y="" or="" n)?="" y="" how="" much="" money="" would="" you="" like="" to="" apply="" from="" card?3="" bill="" information="" ---------------------------------------------------="" total="" of="" all="" items:="" $10.00="" total="" senior="" discounts:="" -$1.00="" taxes:="" +$0.54="" gift="" card="" amount="" applied:="" $-3.00="" -------="" bill:="" $6.54="" sample="" program="" run="" #3="" (one="" purchases="" with="" lunch="" special)="" restaurant="" register="" dish="" no.="" dish="" name="" price="" ---------="" ---------------="" --------="" 1="" gang="" gai="" $10.00="" 2="" pad="" thai="" $8.75="" 3="" pad="" cashew="" $9.50="" 4="" pad="" prik="" $10.25="" 5="" peanut="" curry="" $9.50="" 6="" curry="" noodle="" $11.25="" enter="" the="" item="" number="" you="" want="" (1-6):="" 1="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" n="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?="" n="" do="" you="" have="" a="" gift="" card="" (y="" or="" n)?="" n="" bill="" information="" ---------------------------------------------------="" total="" of="" all="" items:="" $10.00="" total="" of="" all="" items:="" $10.00="" lunch="" special="" discount:="" -$0.50="" taxes:="" +$0.57="" -------="" bill:="" $10.07="" sample="" program="" run="" #4="" (two="" purchases="" with="" lunch="" special,="" senior="" special="" and="" gift="" card)="" restaurant="" register="" dish="" no.="" dish="" name="" price="" ---------="" ---------------="" --------="" 1="" gang="" gai="" $10.00="" 2="" pad="" thai="" $8.75="" 3="" pad="" cashew="" $9.50="" 4="" pad="" prik="" $10.25="" 5="" peanut="" curry="" $9.50="" 6="" curry="" noodle="" $11.25="" enter="" the="" item="" number="" you="" want="" (1-6):="" 1="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" d="" invalid="" choice.="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" y="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?="" y="" restaurant="" register="" dish="" no.="" dish="" name="" price="" ---------="" ---------------="" --------="" 1="" gang="" gai="" $10.00="" 2="" pad="" thai="" $8.75="" 3="" pad="" cashew="" $9.50="" 4="" pad="" prik="" $10.25="" 5="" peanut="" curry="" $9.50="" 6="" curry="" noodle="" $11.25="" enter="" the="" item="" number="" you="" want="" (1-6):="" 2="" are="" you="" 65="" years="" old="" or="" older="" (y="" or="" n)?="" n="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?="" b="" invalid="" choice.="" would="" you="" like="" to="" order="" another="" item="" (y="" or="" n)?=""> 65 years old). o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o see sample runs below. o extra credit (+10 points): utilize a user-defined function for this functionality (see grading rubric below). • next, ask the customer if they would like to order another item. o if they indicate yes, repeat the steps above, i.e. re-display the menu, get user input, etc. o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o thus, the menu and this user input will be in a loop. • once the customer indicates they do not want to order another item, then proceed to these next steps. • extra credit (+10 points): o using a user-defined function, apply a 5% discount to the bill if the current day/time is monday from 11 am to 2:59 pm i.e. a monday lunch special. • apply 6% taxes to the bill. o see sample runs below. • ask the customer if they have a gift card they want to use. o validate this user input (i.e. yes/no). display an appropriate error message and re-prompt the customer until valid input is entered. o if yes, ask them how much money they would like apply towards the bill. o validate/ensure this amount is not greater than the bill amount (i.e. you can’t apply more gift card money than the bill is for). display an appropriate error message and re-prompt the customer until valid input is entered. o reduce the bill amount by the valid gift card amount indicated by the customer. o see sample runs below. • display the final bill information as shown in the sample runs below. • ensure your program is well-documented throughout with informative comments/remarks. sample program run #1 (one purchase with no specials) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 7 invalid item choice. enter valid item number (1-6): 1 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? n do you have a gift card (y or n)? n bill information --------------------------------------------------- total of all items: $10.00 taxes: +$0.60 ------- bill: $10.60 sample program run #2 (one purchases with senior special and gift card) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? y would you like to order another item (y or n)? n do you have a gift card (y or n)? y how much money would you like to apply from card?3 bill information --------------------------------------------------- total of all items: $10.00 total senior discounts: -$1.00 taxes: +$0.54 gift card amount applied: $-3.00 ------- bill: $6.54 sample program run #3 (one purchases with lunch special) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? n do you have a gift card (y or n)? n bill information --------------------------------------------------- total of all items: $10.00 total of all items: $10.00 lunch special discount: -$0.50 taxes: +$0.57 ------- bill: $10.07 sample program run #4 (two purchases with lunch special, senior special and gift card) restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 1 are you 65 years old or older (y or n)? d invalid choice. are you 65 years old or older (y or n)? y would you like to order another item (y or n)? y restaurant register dish no. dish name price --------- --------------- -------- 1 gang gai $10.00 2 pad thai $8.75 3 pad cashew $9.50 4 pad prik $10.25 5 peanut curry $9.50 6 curry noodle $11.25 enter the item number you want (1-6): 2 are you 65 years old or older (y or n)? n would you like to order another item (y or n)? b invalid choice. would you like to order another item (y or n)? n>