CHALLENGE This tool is provided by a third party Though your activity may be rec
ID: 2267623 • Letter: C
Question
CHALLENGE This tool is provided by a third party Though your activity may be recorded, a page refresh may be needed to fill the banner 61.2: Bridge toll. ACTIVITY Bridge toll Complete the example to calculate finafToll The base toll or a bridge is base Toll I the vehicle's weight is over 5,000 pounds, then an additional 4 dollars is added to the toll. Lastly, the toll amount is doubled due to heavy traffic. Your Function Save Reset MATLAB Documentation 1 function finalToll - CalculateToll(baseToll, vehicleweight) 3Assign fina Toll with baseTou. 51 finalToll = baseToll; 7 If the vehicle's weight is over 5800, increase the toll by 4 dollars. 9 if (vehicleweight-5000) 10 11%Increase toll by 4 dollars 12 13, finalToll+=4; 14 15 end 16 17 sDouble toll amount by heavy traffic. 18 19 finalTolleefinalToll; 20 21 end Code to call your function C Reset 1 CalculateToll(10, 3500) Run Function 1Explanation / Answer
Matlab Script:
function finalToll = CalculateToll(baseToll, vehicleWeight)
finalToll = baseToll;
if (vehicleWeight>5000)
finalToll+=4;
end
finalToll = 2*finalToll; %doubling the toll
end
command window log: