Question
A widget shop sells two types of widgets. Widget A is priced at $17 each and Widget B at $29 each. A volume discount is
A widget shop sells two types of widgets. Widget A is priced at $17 each and Widget B at $29 each. A volume discount is provided based on a two digit code stored in the program with the first digit showing the reduction in unit price for every unit of Widget A ordered beyond 10 units. Similarly, the second digit shows the reduction for every unit of Widget B beyond 5 units. The discount code currently is set to 23, i.e., $2 off the price of Widget A and $3 off the price of Widget B as long as the volume conditions are met. (The discount code could be changed from time to time.) Sales tax is charged at 7.5% after discounts unless the order is for out of state, in which case it is 5%. Shipping costs are $1.15 per widget in state and $2 per widget out of state. There is also a fixed handling cost of $12.50 for an entire order. (Sales tax is not charged on shipping and handling costs.) Write a program in Python that asks users for their name and the order quantity of each type of widget and whether the order is for out of state. (Most orders are in state.) The program should validate each order quantity to ensure it is a non-negative integer. It should display the users name in all messages, e.g., error messages, order summary, etc. It should show the total cost to the user. (The total cost should be rounded to two places after the decimal.) The program should be modular, i.e., there should be separate functions to handle input of quantity, discount, tax, shipping, and cost computations.
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