Write a program named lastname _ firstname _if_nested.py that does the following: Ask user for a unit
Fantastic news! We've Found the answer you've been seeking!
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 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!
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date: