COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 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

```"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

```
"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*

for Engineers" by Holly Moore.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
http://www.mathworks.com

```
 0

2 Replies
415 Views

Similiar Articles:

7/23/2012 7:26:36 PM