Question
You have been asked to write a program that calculates the total price for a picnic lunch that the user is purchasing for a group
You have been asked to write a program that calculates the total price for a picnic lunch that the user is purchasing for a group of friends.
Your program should:
Ask the user to enter her budget for the lunch
The user has the option of buying apples, cheese, and bread.
Set the price per apple, price per pound of cheese, and price per loaf of bread as constant variables.
Use a nested repetition/selection structure to ask the user what type of item and how much of each item he/she would like to purchase.
Keep a running total of the items purchased inside the loop.
Exit the loop if the total has exceeded the user’s budget.
Additionally, provide a sentinel value that allows the user to exit the purchasing loop at any time.
After the loop is exited, display the total amount spent, the total amount of each item purchased (quantity and cost) and the amount of the budget that remains.
Be sure to include appropriate documentation at the start of the program and within the program.
Step by Step Solution
3.31 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
I have provided u Python program not using any functions apples15 cheese3 bread1 total 0 pr...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started