Question: Complete the function Calculate Toll. Use an if statement to determine if the vehicle's weight is over 5,000 pounds. Ex: Calculate Toll(10, 3500) yields

Complete the function Calculate Toll. Use an if statement to determine if

the vehicle's weight is over 5,000 pounds. Ex: Calculate Toll(10, 3500) yields

20. Hint: An if statement has a closing end statement. Function 1

Complete the function Calculate Toll. Use an if statement to determine if the vehicle's weight is over 5,000 pounds. Ex: Calculate Toll(10, 3500) yields 20. Hint: An if statement has a closing end statement. Function 1 function finalToll CalculateToll (baseToll, vehicleWeight) 2 % baseToll: The base toll to cross a bridge in dollars. 3 % vehicleWeight: Weight of a vehicle in pounds. 4 5 6 7 8 9 10 11 12 end % TODO: Assign finalToll with base Toll finalToll = 0; Save C Reset MATLAB % TODO: If vehicleWeight is over 5,000 pounds, increase finalToll by 4 dollars. % TODO: Assign finalToll with twice the value of finalToll 10. t-else stat 6 7 8 9 10 11 12 end finalToll = 0; % TODO: If vehicleWeight is over 5,000 pounds, increase finalToll by 4 dollars % TODO: Assign finalToll with twice the value of finalToll Code to call your function 1 Calculate Toll (10, 3500) Assessment: Check if Calculate Toll(10, 3500) returns 20. Check if Calculate Toll (15, 6200) returns 38.

Step by Step Solution

3.37 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the complete function in MATLAB luaCopy code function finalTo... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!