Due by Friday, February 19, midnight
Educational goals of this lab - verify that every student can use if statements and compare strings.
Watch these videos:
Submit your program with the Canvas Link.
INSTRUCTIONS:
Food Item | Price |
---|---|
Grilled Cheese | $7 |
Nachos | $5 |
Chicken | $8 |
Hamburger | $8 |
Cheeseburger | $10 |
Hot Dog | $6 |
Welcome to Dairy King Please answer each question with y or n Do you want a grilled cheese sandwich? y Do you want a serving of nachos? n Do you want a chicken sandwich? n Do you want a Hamburger? n Do you want a hot dog? n The total for your food is $7.00 The total with 20% tip is $8.40 Thank you for your business!
Welcome to Dairy King Please answer each question with y or n Do you want a grilled cheese sandwich? n Do you want a serving of nachos? n Do you want a chicken sandwich? n Do you want a Hamburger? y Do you want cheese on that? n Do you want a hot dog? y The total for your food is $14.00 The total with 20% tip is $16.80 Thank you for your business!
Welcome to Dairy King Please answer each question with y or n Do you want a grilled cheese sandwich? n Do you want a serving of nachos? y Do you want a chicken sandwich? n Do you want a Hamburger? y Do you want cheese on that? y Do you want a hot dog? n The total for your food is $15.00 The total with 20% tip is $18.00 Thank you for your business!
(10 points) Individual Problem #1: Test cases
Description | Input 5 or 6 y's and n's | Expected Output Total, Total+Tip |
---|---|---|
Example | y,y,n,n,n | $12, $14.40 |
Only one item, not hamburger | n,y,n,n,n | ___A.___ |
Only one item, hamburger, no cheese | n,n,n,y,n,n | ___B.___ |
Three items desired | y,y,y,n,n | ___C.___ |
No item desired | n,n,n,n,n | ___D.___ |
All items, including cheese | y,y,y,y,y,y | ___E.___ |
(10 points) Individual Problem #2: Write a design
''' Purpose: offer the user a choice of food items, calculate total bill Pre-conditions: user enters 5 or 6 y's or n's depending on desired items (strings) Post-conditions: prompts for choices, total bill before (float) and after tip, (float) and parting message. ''' # name of restaurant # give user instructions of expected inputs # initialize total bill to zero # ask first choice # if the user desired the item, #add price to total bill complete this part # output blank line # output total bill before tip complete rest of design
(50 points) Individual Problem #3: Calculating a bill using if statements
Remember to submit your program source (hw4.py) with the Canvas link.