Question: include proper comments Problem 4 (15 points): MATLAB script-4 The cost per mile for a rented vehicle is $1.00 for the first 100 miles, $0.85
Problem 4 (15 points): MATLAB script-4 The cost per mile for a rented vehicle is $1.00 for the first 100 miles, $0.85 for the next 200 miles, and $0.65 for all miles in excess of 300 miles. Write a .m file that determines the total cost and the average cost per mile for a given number of miles (stored in a variable distance). Use the following fprintf statement as an output: "For a total distance of XX.X miles, the total cost is $XXX.XX and the average cost per mile is $X.XX." Sample Input/Output Enter the total miles traveled: 515 For a total distance of 515.0 miles, the total cost is $409.75 and the average cost per mile is $0.80
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
