Need help figuring out how to write the script for this problem.

  • Follow


Most major airports have separate parking lots for long-term and short-term parking.  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 2008.

+ Long-Term (Economy) Parking
 --+ The first hour is $1.00, and each additional hour or fraction thereof is $1.00.
 --+ Daily maximum $6.00
 --+ Weekly maximum $42.00
+ Short-Term Parking
 --+ The first 30 minutes of parking are free and each additional 20 minutes or fraction thereof is $1.00
 --+ Daily maximum $25.00
Write a program that asks the user the following:
 --+ Which lot are you using?
 --+ How many weeks, days, hours, and minutes did you park?

Your program should then calculate the parking bill.

You must also include an error check using a conditional loop to ensure correct input for the lot type, i.e. 1 or 2. Use switch/case to determine the cost for the type lot entered. Print the input as well as the cost with appropriate labeling. Use fprintf for all output with appropriate labeling.
0
Reply Taylor 11/4/2010 5:35:04 PM

"Taylor " <tdb_28@yahoo.com> wrote in message <iauqs8$b4r$1@fred.mathworks.com>...
> Most major airports have separate parking lots for long-term and short-term parking.  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 2008.
> 
> + Long-Term (Economy) Parking
>  --+ The first hour is $1.00, and each additional hour or fraction thereof is $1.00.
>  --+ Daily maximum $6.00
>  --+ Weekly maximum $42.00
> + Short-Term Parking
>  --+ The first 30 minutes of parking are free and each additional 20 minutes or fraction thereof is $1.00
>  --+ Daily maximum $25.00
> Write a program that asks the user the following:
>  --+ Which lot are you using?
>  --+ How many weeks, days, hours, and minutes did you park?
> 
> Your program should then calculate the parking bill.
> 
> You must also include an error check using a conditional loop to ensure correct input for the lot type, i.e. 1 or 2. Use switch/case to determine the cost for the type lot entered. Print the input as well as the cost with appropriate labeling. Use fprintf for all output with appropriate labeling.



So if I write the function to do this, I get the A in your class right?
0
Reply Sean 11/4/2010 5:46:04 PM



"Taylor " <tdb_28@yahoo.com> wrote in message 
news:iauqs8$b4r$1@fred.mathworks.com...
> Most major airports have separate parking lots for long-term and 
> short-term parking.  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 2008.

*snip*

Ask Ryan.

http://www.mathworks.com/matlabcentral/newsreader/view_thread/295428

Or perhaps you can help your professor with help for problem 8.32 in "MATLAB 
for Engineers" by Holly Moore.

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Reply Steven_Lord 11/4/2010 5:47:48 PM

2 Replies
415 Views

(page loaded in 0.028 seconds)

Similiar Articles:













7/23/2012 7:26:36 PM


Reply: