Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python please and thank you so much - The problem is to present menu choices from a restaurant to a customer, and calculate the

in python please and thank you so much image text in transcribed
image text in transcribed
image text in transcribed
- The problem is to present menu choices from a restaurant to a customer, and calculate the bill (total of the prices of the items they chose). - Welcome to Chuy's. here is our menu: - Sample Run 1: (one item, a Chicka-Chicka Boom-Boom) Welcome to Chuy's Please answer each question with y or n Would you like to try our Chicka-Chicka Boon-Boon? y Can I get you some Chicken Flautas? n How about Crispy Tacos? n Can I interest you in sore Quesadillas? n niould you like to try our Tres Leches? n The total for your food is $14.89 Your total with 208 tip is $16.91 Thanks for choosing to eat with us today! - Sample Run 2: (two items, a Quesadilla and Tres Leches) Welcone to Chuy's Please answer each question with y or n nould you like to try our Chicka-Chicka Boom-Boom? n Can I get you some Chicken Flautas? n How about Crispy Tacos? n Can I interest you in sore Quesadillas? y Would you like to add cheese to that? n Would you like to try our Tres Leches? y The totol for your food is $17.49 Your total with 20 tip is $20.99 Thanks for choosing to eat with us today! (10 points) Individual Problem \#2: Write a design Here is the start of a design for this problem. You need to finish it. To save yourself time, put it in a py file and make each step a comment. Name it hw4.py - You do NOT have to NUMBER the steps! - Don't forget your personal info (name and email) in the prolog. Purpose: offer the user a choice of food items, calculate total bitl Pre-conditions: user enters 5 or 6y 's or n 's depending on desired items (strings) post-conditions: prompts for choices, total bill before (float) and after 20s tip, (float) and parting message. \# nase of food vendor " give user instructions of expected inputs \# initialize total bill to zero \# ask first choice \# if the user desired the ites, \#odd price to total bill complete the design for the rest of the menu " output blank line \# output total bill before 20 tip complete rest of design (50 points) Individual Problem \#3: Calculating a bill using if statements - Write a program that will get some input from the user about a visit to a restaurant. The program will calculate the bill for the food items requested. - Prompt the user to input whether or not they want each of the food items. You can assume the input will be a character that is either a ' y ' or an ' n '. That is, you can assume that they either enter a ' y ' or it's not a ' y '. You don't have to check to see if it IS an ' n '. So if they enter a ' q ', treat it like an ' n '. If they enter a ' Y ' (upper case), treat 't like an ' n '. Print out the total of the bill after all the questions are answered. - Match the sample runs as closely as possible. - Use multi-character meaningful variable names. - You must have a main function with all code inside. - Write this as efficiently as you can, using as few comparisons and if statements as possible, no more than 6 if statements. Note that most of the if's are independent of each other. - This can be done with exactly one else statement in the whole program. - Hint: not every if has to have an else branch. If you find yourself trying to figure out what an else should contain, step back and ask yourself if you need one. You do NOT want to use statements like x=x or x=x+0 ! - Write a program that will get some input from the user about a visit to a restaurant. The program will calculate the bill for the food items requested. - Prompt the user to input whether or not they want each of the food items. You can assume the input will be a character that is either a ' y ' or an ' n '. That is, you can assume that they either enter a ' y ' or it's not a ' y '. You don't have to check to see if it IS an ' n '. So if they enter a ' q ', treat it like an ' n '. If they enter a ' Y ' (upper case), treat it like an ' n '. Print out the total of the bill after all the questions are answered. - Match the sample runs as closely as possible. - Use multi-character meaningful variable names. - You must have a main function with all code inside. - Write this as efficiently as you can, using as few comparisons and if statements as possible, no more than 6 if statements. Note that most of the if's are independent of each other. - This can be done with exactly one else statement in the whole program. - Hint: not every if has to have an else branch. If you find yourself trying to figure out what an else should contain, step back and ask yourself if you need one. You do NOT want to use statements like x=x or x=x+0 ! - Hint: each if statement WILL use some quotes, either single or double (your choice). Do NOT define a variable called y which contains ' y '. It is not necessary. You compare a variable to a string constant like this: if myvar == "p": - To calculate the bill (the arithmetic part of the problem) use an accumulator. Just create one variable by setting it to a zero at the start, then add the prices of the options to it as you go. There is no need to add a zero to it if the user says they do NOT want an option. Use augmented assignment operators (like +=,=,,= ) when useful. - If they say they want a Quesadilla, ONLY THEN ask them if they want a side of Quac on it. You either add $8.49 or $10.43 to the bill. - Also calculate a 20% tip and add it on. Format it on output to two places. - Note that the $ is right next to the dollar amounts. Your output should look like that. - Hint: you do not need any typecasts for this program at all. Remember that the input function returns a string always - you don't have to cast its result AS a string. Remember to submit your program source (hw4.py) with the Canvas link

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions