In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total when the customer is done entering all the items. Assume the sales tax is 7 percent. The customer should be allowed to enter as many items as they wish. The while loop should terminate when the user hit the key (Return) on the keyboard. (Hint: Use a null or empty string). Optionally, if you would like to round the dollar amount to two decimal places, you can use output formatting construct in your print statement. For example: print("Sales tax: ", format(sales_tax, '.2f')) will round to two decimal places.   Expected Output: Enter the item price or to end: 22.50 Enter the item price or to end: 1.99 Enter the item price or to end: 45.30 Enter the item price or to end: 70 Enter the item price or to end: 5 Enter the item price or to end: Subtotal of items purchased: 144.79 Sales tax: 10.14 Total of items purchased: 154.93

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total when the customer is done entering all the items. Assume the sales tax is 7 percent. The customer should be allowed to enter as many items as they wish. The while loop should terminate when the user hit the key (Return) on the keyboard. (Hint: Use a null or empty string). Optionally, if you would like to round the dollar amount to two decimal places, you can use output formatting construct in your print statement. For example: print("Sales tax: ", format(sales_tax, '.2f')) will round to two decimal places.

 

Expected Output:

Enter the item price or <ENTER> to end: 22.50
Enter the item price or <ENTER> to end: 1.99
Enter the item price or <ENTER> to end: 45.30
Enter the item price or <ENTER> to end: 70
Enter the item price or <ENTER> to end: 5
Enter the item price or <ENTER> to end:
Subtotal of items purchased: 144.79
Sales tax: 10.14
Total of items purchased: 154.93

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
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
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