In: Computer Science
Chapter 2, Business P2.32: The following pseudocode describes how a bookstore computes the price of an order from the total price and the number of the books that were ordered. Ask user for the total book price and the number of books. Compute the tax (7.5 percent of the total book price). Compute the shipping charge ($2 per book). The price of the order is the sum of the total book price, the tax, and the shipping charge. Print the price of the order. Translate this pseudocode into a Python program. Submission Requirements Please submit this assignment as a .py file. You will need to use the Python IDLE program (Links to an external site.) to test if your code is running specification.
Pseudocode
START
DECLARE TotalBookPrice
DECLARE NumberOfBooks
DECLARE OrderPrice
INPUT TotalBookPrice
INPUT NumberOfBooks
OrderPrice = TotalBookPrice + (7.5/100)*(TotalBookPrice) + (2 * NumberOfBooks)
PRINT "Order price is: " + OrderPrice
END
Python Program
""" Python program to calculate book order price """ totalBookPrice = int(input('Enter total book price: ')) numberOfBooks = int(input('Enter number of books: ')) orderPrice = totalBookPrice + (7.5/100)*(totalBookPrice) + (2 * numberOfBooks) print('Order price is:', orderPrice)