Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.13 Week 1 Program: Food receipt Note When accuracy is essential floats are not used to represent currency due to rounding and accumulation errors. Python

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
2.13 Week 1 Program: Food receipt Note When accuracy is essential floats are not used to represent currency due to rounding and accumulation errors. Python provides several primitives specifically developed to implement financial applications. However, these topics are beyond the scope of this lab Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print(f'{your_value: 2)) (1) Prompt the user to input a food item name, price, and quantity Output an itemized receipt. (Submit for 2 points) Note: This zylab outputs a newline after each user input prompt. For convenience in the examples below the user's input value is shown on the next line, but such values don't actually appear as output when the program runs Enter food item name! hot dog Enter item price: 2.00 Enter Item quantity! 5 RECEIPT 5 hot dog @ $2.00 - $10.00 Total cont: $10.00 (2) Extend the program to prompt the user for a second item. Output an itemized receipt (Submit for 2 points, so 4 points total) Enter food item name: hot dog Enter item price: 2.00 Enter Item quantity: a (2) Extend the program to prompt the user for a second item Output an Iternized receipt. (Submit for 2 points, so 4 points total) Enter food item nane: hot dog Enter item price: 2.00 Enter item quantity: 5 RECEIPT 5 hot dog @ $2.00 - $10.00 Total cost $10.00 Enter second food item name: ice cream Enter tem price: 2.50 Enter iten quantity: 4 RECEIPT 5 hot dog @ $2.00 - $10.00 4 ice cream @ $2.50 - $10.00 Total cost: $20.00 (3) Extend again to output a third receipt that adds a mandatory 15% gratuity to the total cost Output the total cost the cost of gratuity, and the grand total (Submit for 3 points, so 7 points total) Enter food item name: hot dog Enter item price: 2.00 Enter item quantity: 5 RECEIPT 5 hot dog @ $2.00 - $10.00 Total cost: $10.00 Enter second food item name ice cream Enter item price: 2.50 Enter Item quantity: 4 RECEIPT S hot dog & 32.00 - $10.00 4 ice cream @ $2.50 $10.00 Total cost: $20.00 158 gratuity: $3.00 Total with tip: $23.00 Load default template main.py 8 secondItemPrice - float(input('Enter item price: ')) 9 secondQuantity-int(input('Enter item quantity: ')) 10 . calculate second total price 11 secondTotalPrice - secondItemPrice secondQuantity 12 13 calculate total cost 14 totalCost - totalPrice + secondTotal Price 15 print('Total cost: 54.2f)'.format(totalCost)) 16 17 tipAmount - 15/100. totalCost 18 # output the tip amount and total amount with tip 19 print(" 15% of gratuity: 54:2f}'.format(tipAmount) 20 print('Total with tip: 5:2f)'.format(totalCost tipAmount)) 21 22 Develop mode Submit mode When done developing your program press the Submit for grading button below. This will submit your program for auto grading Submit foranding

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

2. What type of team would you recommend?

Answered: 1 week ago

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago