Question
Write a program named lastname _ firstname _if_nested.py that does the following: Ask user for a unit price of an item. If the price is
Write a program named lastname_firstname_if_nested.py
that does the following:
- Ask user for a unit price of an item.
- If the price is greater than zero:
- Ask user for quantity to purchase (integer).
- If the quantity is greater than zero:
- Calculate subtotal (quantity times unit price), tax at 7.5%, and total.
- Print the subtotal, tax, and total, properly labeled with exactly two digits to the right of the decimal point.
- otherwise:
- print an error telling the customer that the quantity must be greater than zero
- otherwise:
- print an error telling the customer that the unit price must be greater than zero
Your program will, therefore, have nested if
statements. Notice that the preceding instructions give you a very large hint about how to structure your code!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Below is the simple Python program named lastnamefirstnameifnestedpy that follows the specified inst...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 StartedRecommended Textbook for
Concepts of Database Management
Authors: Philip J. Pratt, Mary Z. Last
8th edition
1285427106, 978-1285427102
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App