Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python program (not using any functions): You have been asked to write a program that calculates the total price for a picnic lunch that the

Python program (not using any functions):

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 users 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

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions