Most major airports have separate lots for longterm and shor

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. Long Term Parking 1. The first hour is $1.00, and each additional hour or fraction thereof is $1.00 2. Daily maximum is $6.00 3. Weekly maximum is $42.00 Short Term Parking 1. The first 30 minutes are free and each additional 20 mins or fraction thereof is $1.00 2. Daily maximum is $25.00 Write a program that asks the user the following: 1. Which lot are you using? 2. How many weeks, hours, days, and minutes did you park? Your program should then calculate the parking bill. Then display the parking bill to the command window.

i started off like this but it keep giving me constant errors please help

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); LongTermBill.m fprintf(\'Ticket Number\ Time Stayed:%3f Weeks %2f Days %2f Hours %2f Minutes\ Fee: %4f Dollars\ \',Weeks,Days,Hours,Minutes,bill); end 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 ShortTermBill.m end 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

Solution

IT is given constant errors as you did not define variables for input, so your statement

Weeks=input(\'Weeks:\'); Days=input(\'Days:\'); Hours=input(\'Hours:\'); Minutes=input(\'Minutes:\')

will be written as :

Weeks=input(\'Weeks:\',w); Days=input(\'Days:\',d); Hours=input(\'Hours:\',d); Minutes=input(\'Minutes:\',m)

rest is correct.

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. Long Term Pa

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site