Im very lost on how to make the functions in matlab thanks i

I\'m very lost on how to make the functions in matlab, thanks in advance!

Economy Parking (IE Long Term)

• The first hour is $0.00
• The second hour is $2.00
• Every additional hour is $1.00
• Daily Maximum is $7.00
• Weekly Maximum is $49.00 Note: Any fractional left-over parts of an hour should be charged as if you stayed the whole extra hour.

Hourly / Daily Parking (IE Short Term)
• The first 30 minutes is $0.00
• 31-50 minutes is $2.00
• Every additional 20 minutes is $1.00
• Daily Maximum of $28.00 Note: Any left-over minutes larger than zero and less than 20 should be charged as if you stayed the entire 20 minute period.

Part A: Long Term Parking Write a function for correctly computing the long term parking rate subject to the rules above. Create your function according to the following declaration and save it in SLC_LongTerm.m. function [rate] = SLC_LongTerm( days, hours )
• The function should do some simple validation on the input values \'days\' and \'hours\' and call the error function with a descriptive message for invalid inputs.
• Days and hours should both be non-negative numbers
• Days should be in the range [0, 180]. IE we assume that it is impossible to park for a negative number of days and unreasonable to leave your car in long term parking for more than 6 months.
• Hours should be in the range [0,24) IE everything between zero and 24 not including 24

Part B: Short term parking Write a function for correctly computing the short term parking rate subject to the rules above. Create your function according to the following declaration and save it in SLC_ShortTerm.m. function [rate] = SLC_ShortTerm( days, hours, minutes )
• Similar to the long term function, you should do simple validation on the inputs \'days\' , \'hours\', and \'minutes\' and call the error function for invalid inputs.
• Minutes should be in the range [0, 59) .
• The only changes in validation for days, hours from long term parking is that days should be in the range [0, 60]. IE we assume it is unreasonable to leave your car in short term parking for more than 2 months.

Solution

% Plot Rates

Test Cases (Long Term Parking)
I\'m very lost on how to make the functions in matlab, thanks in advance! Economy Parking (IE Long Term) • The first hour is $0.00 • The second hour is $2.00 •

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site