Question
Python: You are running a promotional product company and you need a program that will develop quotes for customer orders. Input Validation The user will
Python:
You are running a promotional product company and you need a program that will develop quotes for customer orders.
Input Validation
The user will input the product name, order quantity, unit cost, number of ink colors, and whether the customer wants help designing the logo to be printed.
Validate input to make sure the user provides valid data; display an appropriate message if invalid data is entered. Here are the rules for data validation:
-Product name must contain only letters no numbers or special characters (any spaces in the product name should be ignored for the validation test)
-Quantity must be numeric, whole number
-Unit cost must be numeric; user input can allow $ (dollar sign) and . (dot), but you must be able to test that all other characters are actually numbers
-Ink colors must be numeric, whole number
-Design help must be answered with Yes or No or the single letters Y or N; lower-case is also acceptable. When validating this input, you must write the code as efficiently as possible
Calculations
Use the following calculations for creating the price quote:
Setup charge: $7.00 per ink color
Design charge: number of ink colors * unit cost * 8
Materials cost: unit cost * quantity
Customer total: sum of costs/charges plus 20%
Discount: We are having a winter clearance sale on all mugs. If the product name contains the word mug, the customer total is discounted by 10%.
Example output:
Example Data Validation errors:
Product name: ceramic m7g
Product name must contain only letters and spaces
Product name: ceramic mug
Quantity: k
Quantity must be numeric
Product name: ceramic mug
Quantity: 100
Our unit cost for the ceramic mug: 4.pp
cost must be numeric
Product name: ceramic mug
Quantity: 100
Our unit cost for the ceramic mug: 4.99
How many colors will be printed? 2
Does customer require design help? 5
Please answer Yes or No
Assuming good input; with no errors, the program runs to completion
scenario 1:
-Results in discounted total
-full word yes was used during data validation. - sliced to check first letter only.
-- Custom Print Quote --
Enter the following information to create a quote:
Product name: ceramic mug
Quantity: 100
Our unit cost for ceramic mug: 3.05
How many colors will be printed? 2
Does the customer require design help? Yes
------------------------------------------------------------
Product type : Ceramic mug
Materials cost $ 305.00 ("$" and "amounts" lined up)
2 color setup $ 14.00
Custom design $ 48.80
Total $ 441.36
Discounted total for Ceramic mug: $ 397.22
---------------------------------------------------------------------------------------------
Scenario 2:
No "mug" in name - No discount
"N" entered for design question - use efficient validation coding; no reference to design fee in print output
"$" entered on unit cost = manage the input so that it can still be used in calculations.
-- Custom Print Quote --
Enter the following information to create a quote:
Product name: Travel Tumbler
Quantity: 350
Our unit cost for ceramic mug: $5.50 (user input a "$", needs to be removed so it can be used in calculations)
How many colors will be printed? 1
Does the customer require design help? N
------------------------------------------------------------
Product type : Travel tumbler
Materials cost $ 1,925.00 ("$" and "amounts" lined up)
1 color setup $ 7.00
Total $ 2,318.40
(no design fee in output because they said "N")
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