Question
Matlab
Most major airports hgve separate lots for long-term and short-term park- ing. The cost to park depends on the lot you select, and how long you stay Consider this rate structure from the Salt Lake International Airport during the summer of 2016. 8.20 Long-Term (Economy) Parking o The first hour is $2.00, and each additional hour or fraction thereof is $1.00 o Daily maximum $9.00 o Weekly maximum $60.00 . Short-Term Parking 。The first 30 minutes are $2.00 and each additional 20 minutes or fraction thereof is $1.00 o Daily maximum $32.00 Write a program that asks the user the following: Which lot are you using? How many weeks, hours, days, and minutes did you park? Your program should then calculate the parking bill.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

%*****Matlab code******

clear all;
lot= input("Which lot are you using? ","s")
whdm_str=input("How many weeks, hours, days and minute did you park?",'s')
%whdm=regexp(whdm_str,' ','split')
whdm = str2num(whdm_str)
cost = 0.0
if(lot = "Long-Term")
disp("Inside")
%add cost for weeks
if(whdm(1)>0)
cost = cost+whdm(1)*60.00
end
  
%add cost for hours
if(whdm(2)>0)
cost = cost+2 %first hours cost is 2
whdm(2) = whdm(2)-1 %remaining hours are cost is 1
cost = cost+ whdm(2)
end
%add cost for days
if(whdm(3)>0)
cost = cost+9*whdm(3)
end
%add cost for minute
if(whdm(4)>0)
cost = cost+1
end
  
end

%similar as above
if(lot == "Short-Term"==0 && cost!=0.0)
if(whdm(1)>0)
cost = cost+32*7*whdm(1)
end
  
if(whdm(2)>0)
whdm(2)= whdm(2)*60
if(whdm(2)>30)
cost = cost+2
whdm(2)=whdm(2)-30
end
cost = cost+ ceil((whdm(2)/20.0))
end
  
if(whdm(3)>0)
cost = cost+32*whdm(3)
end
  
if(whdm(4)>0)
if(whdm(4)>30)
cost = cost+2
whdm(4)=whdm(4)-30
end
cost = cost+ ceil((whdm(4)/20.0))
end
  
end

disp(cost)

%****Output screenshot***

%****Please do let me know if you have any doubts or want me to modify the code****

Add a comment
Know the answer?
Add Answer to:
Matlab Most major airports hgve separate lots for long-term and short-term park- ing. The cost to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 50. Client-centeredness and humility might look like saying, "Tell me about what's most important to you...

    50. Client-centeredness and humility might look like saying, "Tell me about what's most important to you here." True False 51. Appropriate regression means introducing new tasks weekly. True False 52. Rewarding behaviors, not outcomes means focusing on measurements first. True False 53. A demonstration of your client's mental skills include: Going to the farmer's market, Following the "inner compass" Learning about protein All of the above are correct 54. During step 1 of the coaching process, aim to identify bright...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT