Question: Need this coded using python 3 Calculate the mileage charge Depending on the rental type, the mileage charge is calculated differently. You will need to
Need this coded using python 3
Calculate the mileage charge
Depending on the rental type, the mileage charge is calculated differently. You will need to create add code to calculate the mileage charge for each type of rental. Store the cost of miles drive as the variable mileCharge
1) Code B (budget) mileage charge: $0.25 for each mile driven
mileCharge = total_miles x 0.25
2) Code D (daily) mileage charge: no charge if the average number of miles driven per day is 100 miles or less;
mileCharge = .25 x extraMiles x rentalPeriod
Calculate the averageDayMiles = totalMiles/daysRentedIf averageDayMiles is 100 or less,
extraMiles = 0
If averageDayMiles is above the 100 mile per day limit, calculate:
extraMiles = averageDayMiles - 100
Calculate the cost of the extra miles:
extraMiles x $0.25
3) Code `W` (weekly) mileage charge: no charge if the average number of miles driven per week is 900 miles or less.Calculate the average weekly miles
averageWeekMiles = totalMiles/ weeksRented
If the average number of miles driven per week exceeds 900 miles, the mileCharge is $100.00 per week, otherwise, the mileCharge is $0.00
Calculation Check 2A Add to your script to print the value of the variable mileCharge for greater than a hundred miles
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
