1. Write a Python program to: ask the user to enter the price of an item. Note: use a while loop to check the validity of the price and, if the user enters a price less than or equal to zero, to prompt for a valid price. Prompt the user for the quantity being purchased. If the quantity is ten or greater, apply a discount of 5 percent. (.95*price*quantity). Print a message that includes the price of the item, the quantity being purchased, and the total price after any discount is applied. Test your program's logic by running it multiple times. i.e. enter a non-positive value for price; enter a positive value for price; enter a quantity of 9, 10, and 11. Include in your HW PDF document screen shots of your program code file and of the output of your testing of the logic.
1. Write a Python program to: ask the user to enter the price of an item. Note: use a while loop to check the validity of the price and, if the user enters a price less than or equal to zero, to prompt for a valid price. Prompt the user for the quantity being purchased. If the quantity is ten or greater, apply a discount of 5 percent. (.95*price*quantity). Print a message that includes the price of the item, the quantity being purchased, and the total price after any discount is applied. Test your program's logic by running it multiple times. i.e. enter a non-positive value for price; enter a positive value for price; enter a quantity of 9, 10, and 11. Include in your HW PDF document screen shots of your program code file and of the output of your testing of the logic.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 15PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning