Azzera filtri
Azzera filtri

How to compute for finalToll

4 visualizzazioni (ultimi 30 giorni)
ELIZA BAUTISTA
ELIZA BAUTISTA il 25 Lug 2020
Commentato: David Hill il 25 Lug 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

Risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by