(1) Prompt the user to input a food item name, price, and quantity. Output an itemized receipt.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question

Hello i need help with this problem. I keep getting it wrong. The program is in python,

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: .2f}')
(1) Prompt the user to input a food item name, price, and quantity. Output an itemized receipt.
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 cost: $10.00
(2) Extend the program to prompt the user for a second item. Output an itemized receipt.
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:
RECEIPT
5 hot dog @ $2.00 = $10.00
4 ice cream @ $2.50 = $10.00
Total cost: $20.00
Transcribed Image Text: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: .2f}') (1) Prompt the user to input a food item name, price, and quantity. Output an itemized receipt. 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 cost: $10.00 (2) Extend the program to prompt the user for a second item. Output an itemized receipt. 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: 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.
Enter food item name:
hot dog
Enter item price:
2.00
Enter item quantity:
10
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:
RECEIPT
5 hot dog @ $2.00 = $10.00
4 ice cream @ $2.50 = $10.00
Total cost: $20.00
15% gratuity: $3.00
Total with tip: $23.00
454192.2153518.qx3zqy7
LAB
ACTIVITY 2.20.1: LAB*: Program: Food receipt
1 item_name = input('Enter food item name: \n')
2
3
4 item_price=input('Enter item price:\n')
5
6
7 item_quantity=input('Enter item quantity: \n")
8 print ()
9 receipt
input('RECEIPT \n')
10 print ()
11 total cost = input('5 hot dog @ $2.00 = $10.00')
12
13 print('{your_value: .2f}')]
14
15 item nama
input("Enter second food item name\n')
main.py
Load default template...
Transcribed Image Text:(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. Enter food item name: hot dog Enter item price: 2.00 Enter item quantity: 10 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: RECEIPT 5 hot dog @ $2.00 = $10.00 4 ice cream @ $2.50 = $10.00 Total cost: $20.00 15% gratuity: $3.00 Total with tip: $23.00 454192.2153518.qx3zqy7 LAB ACTIVITY 2.20.1: LAB*: Program: Food receipt 1 item_name = input('Enter food item name: \n') 2 3 4 item_price=input('Enter item price:\n') 5 6 7 item_quantity=input('Enter item quantity: \n") 8 print () 9 receipt input('RECEIPT \n') 10 print () 11 total cost = input('5 hot dog @ $2.00 = $10.00') 12 13 print('{your_value: .2f}')] 14 15 item nama input("Enter second food item name\n') main.py Load default template...
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage