Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manner:TAXI FARE CALCULATOREnter beginning odometer reading=> 78602.5Enter ending odometer reading=> 78622.7You traveled a distance of 20.2 miles. At $1.50 per mile,your fare is $30.30.

Respuesta :

Answer:

print("TAXI FARE CALCULATOR\n")

beginning = float(input("Enter beginning odometer reading => "))

ending = float(input("Enter ending odometer reading => "))

distance = ending - beginning

fare = 1.50 * distance

print("You traveled a distance of %.1f" % distance + " miles. At $1.50 per mile, your fare is $ %.2f" % fare)

Explanation:

*The code is in Python.

Print the title

Ask the user to enter beginning and ending of the odometer reading. Calculate the distance by subtracting these values

Calculate the fare, multiply the distance by 1.50

Print the distance and fare in required format

Otras preguntas