Question: Complete the function Calculate Toll. Use an if statement to determine if the vehicle's weight is over 5 , 0 0 0 pounds. Ex .

Complete the function Calculate Toll. Use an if statement to determine if the vehicle's weight is over 5,000 pounds.
Ex. CalculateToll (10,3500) yields 20
Hint An if statement has a closing end statement.
Function o.
B Save
C Reset
MATLAB Documentation
function finalToll = CalculateToll (baseToll, vehicleweight)
% baseToll: The base toll to cross a bridge in dollars
% vehicleweight: Weight of a vehicle in pounds
% TODO: Assign finalToll with baseToll
finalToll =;
% TODO: If vehicleweight is over 5,000 pounds, increase finalToll by 4 dollars
% TODO: Assign finalToll with twice the value of finalToll
end
Code to call your function ?
C Reset
1
CalculateToll(10,3500)
 Complete the function Calculate Toll. Use an if statement to determine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!