Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4 Trish at Bargain Used Books has hired you to write a Python program that will help her calculate what a customer should pay.

Problem 4

Trish at Bargain Used Books has hired you to write a Python program that will help her calculate what a customer should pay. She has a very simple price structure:

  • Paperback books are $2.50 each.
  • Hardback books are $7.00 each.
  • Magazines are $3.95 each.

With every purchase, Trish also must charge 7% sales tax on the total.

Create a file named Lab01P4.py. Write a program that calculates the cost for the total purchase:

  • Ask the user to enter the number of paperbacks, hardbacks, and magazines being purchased.
  • Calculate the total before tax.
  • Calculate the amount of sales tax on the total.
  • Calculate the total after tax.
  • Output the total before tax, the sales tax, and the total after tax.

NOTE: Your program code should implement these steps IN THE SAME ORDER as listed above.

All monetary values should be output with a precision of 2 digits after the decimal point. You should use what was presented in this lesson to achieve that result.

----------------------------------------------------------

Sample Output:

Enter the number of paperback books: 3

Enter the number of hardback books: 2

Enter the number of magazines: 4

Cost before tax: $37.30

Sales tax: $2.61

Cost after tax: $39.91

-------------------------------------------

In your program, besides the header comment, add three additional comments:

  • A comment that identifies where the input steps begin
  • A comment that identifies where the processing steps begin
  • A comment that identifies where the output steps begin.

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

Students also viewed these Databases questions

Question

Name the key aspects of supply chain management. LO.1

Answered: 1 week ago

Question

Sea i = 0,1. Encuentre el valor de t, 0 Answered: 1 week ago

Answered: 1 week ago

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago