Many airports have separate parking lots for short-term and long-term parking. The cost to park depends on the lot you select, and how long you stay. Here is the rate structure for three types of parking lots at Portland International Airport (PDX):
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
This is the code I have so far. I'm struggling including the maximum amount that can be charged in a day.
% Accept the inputs from the user
lot=input('Which parking lot are you using?\n1.Economy\n2.Long-term\n3.Short term\n');
fprintf('How many days and hours did you park for?\n');
days=input('Days : ');
hours=input('Hours : ');
cost=0;
% Calculate the total cost
if(lot==1)
cost=10*days+3*ceil(hours);
elseif(lot==2)
cost=21*days+3*ceil(hours);
elseif(lot==3)
cost=27*days+3*ceil(hours);
% For invalid inputs
else
fprintf('Enter valid inputs\n');
exit
end
% Display the total cost
fprintf('The total cost is %f\n',cost);
1 comentario
Sai Sri Pathuri
el 27 de Mayo de 2020
The code works fine at my end. Can you attach the rate structure and elaborate the issue you are facing?
Respuestas (0)
Ver también
Categorías
Más información sobre Financial Toolbox 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!