Answer:
The correct order is:
# display a welcome message
print("Bookstore Calculator")
# get input from the user
book_price = float(input("Price of book: "))
tax_percent = float(input("Tax percent: "))
# calculate tip and total amount
tax_amount = round(book_price *(tax_percent / 100), 2)
total = round(book_price + tax_amount, 2)
# display the results
print("Tax amount: ", tax_amount)
print("Total amount:", total)
Step-by-step explanation:
Given
The above code segment
Required
Place the code in correct order
Using the sample output as a guide:
The first output is a welcome message.
So, the first and second line of the program is:
# display a welcome message
print("Bookstore Calculator")
Next, inputs for book price and tax percent.
So, the next lines are:
# get input from the user
book_price = float(input("Price of book: "))
tax_percent = float(input("Tax percent: "))
Next, outputs for tax amount and total amount.
These outputs must first be calculated.
So, the next lines are:
# calculate tip and total amount
tax_amount = round(book_price *(tax_percent / 100), 2)
total = round(book_price + tax_amount, 2)
Lastly, the results are printed
# display the results
print("Tax amount: ", tax_amount)
print("Total amount:", total)