Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROBLEM 3 Trish at Bargain Swap Shop has been using the programs you developed for her and really likes them. Recently however, she hired a
PROBLEM
Trish at Bargain Swap Shop has been using the programs you developed for her and really likes them. Recently however, she hired a new cashier who isn't very good at data entry. In particular, she needs the program to catch data entry errors that are made and give the user a chance to reenter the data.
To help her out, you'll be taking the first program you developed for her Lab Problem and rewrite it so that it blocks out some data entry errors. Here's the changes that she'd like to see:
A user should never be able to enter a negative number for the number of books, DVDs or games that are being purchased. Zero is a valid entry.
It is extremely rare that someone buys a LOT of a particular item, so Trish wants the program to limit the number of each item type someone can purchase. These are the limits she wants to set:
o Books: Maximum of
o DVDs: Maximum of
o Games: Maximum of
Other than these checks on the data entry, the program should execute as it did before.
NOTE: We are not handling issues where a user types an invalid integer, that is an entry which cannot be converted using the int function. We will handle that in a future lab.
The costs of each item type are the same as in Lab :
Books are $ each.
DVDs are $ each.
Games are $ each.
Create a file named LabPpy Write a program that calculates the cost for the total purchase:
Ask the user to enter the number of workbooks, textbooks, and magazines being purchased.
If the user enters a negative number, or goes above the maximum for a particular item, the program should continue to ask the user to enter a number until it is valid.
Calculate the total before tax.
Calculate the amount of sales tax on the total. Tax is
Calculate the total after tax.
Output the total before tax, the sales tax, and the total after tax.
Sample Output:
Enter the number of books:
Number of books must be between and
Enter the number of books:
Number of books must be between and
Enter the number of books:
Enter the number of DVDs:
Number of DVDs must be between and
Enter the number of DVDs:
Enter the number of games:
Number of games must be between and
Enter the number of games:
Number of games must be between and
Enter the number of games:
Cost before tax: $
Sales tax: $
Cost after tax: $
Remember to format monetary amounts with digits after the decimal.
NOTE: There are no discounts in this program.
Hint: If you need help with validating user input, review section in your textbook.
Run this program using the PyCharm Terminal. Take a screenshot of the Terminal that includes the line showing where you started the program run with the results. Name the screenshot LabPouput.jpg
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started