Question: 1. Write a function called farecalc that computes the bus fare one must pay in Lawrence MV Transit based on the distance travelled. Here is
1. Write a function called farecalc that computes the bus fare one must pay in Lawrence MV Transit based on the distance travelled. Here is how the fare is calculated: the first mile is $2 Each additional mile up to a total trip distance of 10 miles is 25 cents per mile. Each additional mile over 10 miles is 10 cents per mile. Miles are rounded to the nearest integer other than the first mile which must be paid in full once a journey begins. The input to the function would be the distance of the journey. Return the fare in dollars, e.g., 2.75 would be the result returned for a 4-mile trip
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
