How to compute for finalToll

10 visualizaciones (últimos 30 días)
ELIZA BAUTISTA
ELIZA BAUTISTA el 25 de Jul. de 2020
Comentada: David Hill el 25 de Jul. de 2020
Complete the example to calculate final Toll. The base toll for a bridge is base Toll. If the vehicle's weight is over 5,000 pounds, then an additional 4 pesos is added to the toll. Lastly, the toll amount is doubled due to heavy traffic.
Starter code
function finalToll = CalculateToll(baseToll, vehicleWeight)
% baseToll: The base toll to cross a bridge in pesos
% vehicleWeight: Weight of a vehicle in pounds
% Assign finalToll with baseToll
finalToll = 0;
% If vehicle's weight is over 5,000 pounds, increase toll by 4 pesos
% Double toll amount due to heavy traffic
end
Assessments
Check if CalculateToll(10, 3500) returns 20
Check if CalculateToll(15, 6200) returns 38

Respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by