Answer:
- mileage = float(input("Enter mileage: "))
-
- if (mileage > 100):
- amount = (mileage - 100) * 0.15 + 100 * 0.25
- else:
- amount = mileage * 0.25
-
- print("Total amount: $" + str(amount))
Step-by-step explanation:
The solution code is written in Python 3.
Firstly, prompt user to input a mileage (Line 1).
Next, create an if statement to check if a mileage greater than 100 (Line 3). If so, apply the formula to calculate amount with mileage above 100 (Line 4) otherwise, calculate the amount just by multiplying the mileage by 0.25.
At last, print the total amount (Line 8).