Question

In: Computer Science

Most Major airports have separate lots for long-term and short-term parking. The cost to park depends...

Most Major airports have separate lots for long-term and short-term parking. The cost to park depends on the lot you select , and how long you stay. Considering this rate structure 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.

Long-Term (Economy) Parking

-The First Hour is $2.00, and each additional hour or fraction thereof is $1.00

-Daily maximum $9.00

-Weekly maximum $60

Short Term Parking

-The first 30 minutes are $2.00 and each additional 20 minutes or fraction thereof is $1.00

-Daily maximum $32.00

Write a program using matlab that asks the user the following:

-Which lot are you using?

-How many weeks, hours, days, and minutes did you park? Your program should calculate the parking bill.

Solutions

Expert Solution

Solution:

code:

lot=menu('Which lot do you want to park at?','Long-Term Lot','Short-term Lot');

disp('How long did you park in the lot?');

Weeks=input('Weeks:');

Days=input('Days:');

Hours=input('Hours:');

Minutes=input('Minutes:');

switch lot

case 1

bill=LongTermBill(Weeks,Days,Hours,Minutes);

case 2

bill=ShortTermBill(Weeks,Days,Hours,Minutes);

end

fprintf('Ticket Number\nTime Stayed:%3f Weeks %2f Days %2f Hours %2f Minutes\nFee: %4f Dollars\n',Weeks,Days,Hours,Minutes,bill);

LongTermBill.m

function result=LongTermBill(w,d,h,m)

% Makes the calculation the Long-Term Bill

hours=h+(m/60); %adds hours and minutes

hours=ceil(hours);%rounds to the nearest hour

if(hours>=6)

LTbill=(42*w)+(6*d)+6; %adds the total bill

else

LTbill=(42*w)+(6*d)+hours; %adds the total bill

result=Thebill

end

ShortTermBill.m

function result=ShortTermBill(w,d,h,m)

% Makes the calculation the Short-Term Bill

minutes=((h*60)+m)-30);

MinutesPrice=minutes/20;

MinutesPrice=ceil(MinutesPrice);

WeekPrice=7*25; %price to stay in st parking for a week

if(MinutesPrice>=25)

STbill=(WeekPrice*w)+(25*d)+25; % adds the total bill

else

STbill=(WeekPrice*w)+(25*d)+MinutesPrice; %adds the total bill

result=STbill;

end

Hit the thumbs up if you liked the answer. :)


Related Solutions

3. Sydney Rangers Inc operates remote parking lots near major airports. The board of directors of...
3. Sydney Rangers Inc operates remote parking lots near major airports. The board of directors of this family-owned company believes that Sydney Rangers could earn an additional $2 million income before interest and taxes by expanding into new markets. However, the $5 million that the business needs for growth cannot be raised within the family. The directors, who strongly wish to retain family control of the company, must consider issuing securities to outsiders. Sydney Rangers’s Plan 1 is to borrow...
the use of cost information in short- a term long- term, and strategic decisions making, planning...
the use of cost information in short- a term long- term, and strategic decisions making, planning and control in contemporary organizations
What impact (short term and long term) did the roman conquest have on Britain?
What impact (short term and long term) did the roman conquest have on Britain?
Does compound interest have more of an impact on short term investments or long term investments?...
Does compound interest have more of an impact on short term investments or long term investments? Do you think it’s possible to have uninterrupted compound growth?
26) A. At many synapses in the hippocampus, long‑term potentiation depends on the             activation of...
26) A. At many synapses in the hippocampus, long‑term potentiation depends on the             activation of NMDA receptors which have affinities for and respond to __________:              a. GABA. b. glutamate. c. dopamine. d. norepinephrine. e. nitric oxide. B. Based on imaging research of the brain, the region known as DLPFC (dorsolateral    prefrontal cortex) is associated with __________:             a. verbal tasks.             b. executive control.             c. spatial tasks.             d. all of the above.             e. none...
Distinguish between short-term and long-term finance sources.?
Distinguish between short-term and long-term finance sources.?
RideShare offers short-term rentals of vehicles that are kept in small lots in urban neighborhoods with...
RideShare offers short-term rentals of vehicles that are kept in small lots in urban neighborhoods with plenty of potential customers. With one lot, it has eight cars. The interarrival time of potential demand for this lot from its base of customers is 40 minutes. The average rental period is five hours. If a customer checks availability of vehicles in this lot online and finds that they are all rented for the desired time, the customer skips renting and finds alternative...
Most companies borrow money for long term projects and in addition to this long term debt...
Most companies borrow money for long term projects and in addition to this long term debt they also have other long term commitments (such as a lease). What types of long term commitments might a company have and how do we gauge their ability to pay these commitments in the future?
what are the short term and long term affects of increased government spending?
what are the short term and long term affects of increased government spending?
Discuss the risks associated with long term and short term exposure to radiation.
Discuss the risks associated with long term and short term exposure to radiation.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT