Final answer:
To create an algorithm that calculates the discount applied and the new subtotal after the discount has been applied, follow these steps: read in the subtotal, check if it's greater than $100, calculate the discount based on the subtotal, subtract the discount from the subtotal, and print the discount applied and the new subtotal.
Step-by-step explanation:
To create an algorithm that calculates and prints the discount applied and the new subtotal after the discount has been applied, you can follow the steps below:
- Read in the subtotal of the order.
- If the subtotal is greater than $100, calculate the discount as 40% of the subtotal. Otherwise, calculate the discount as 25% of the subtotal.
- Subtract the discount from the subtotal to get the new subtotal.
- Print the discount applied and the new subtotal.
For example:
subtotal = read_input()
if subtotal > 100:
discount = subtotal * 0.4
else:
discount = subtotal * 0.25
new_subtotal = subtotal - discount
print('Discount applied:', discount)
print('New subtotal:', new_subtotal)