Homework2

Homework2 - %Code for parking receipt clear;clc disp'Please use whole numbers while answering the questions do not use decimals round up to the

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
%Code for parking receipt clear;clc; disp('Please use whole numbers while answering the questions, do not use decimals, round up to the nearest incriment spcified (if you were parked for 15 minutes and it charges by 30 minute intervals, round up to 30 minutes). Also enter words as specified: if it say enter yes or no, do NOT enter Yes or No.\n') type=input('Enter 1 for short term parking, 2 for daily parking in P3, 3 for daily parking in P4, or 4 for economy long term parking'); switch type % Short term parking code case 1 disp('Short term parking costs 3.00$ for each half hour, up to a maximum of 33.00$ for an entire day. If you stayed for 5 hours and 30 minutes or longer please input that you stayed a full day.') time=input('Did you stay for more than 5 hours and 30 minutes? (If you stayed 5 hours and 30 minutes or longer you are charged for an entire day). Enter: yes or no\n','s'); switch time case 'no' hour=input('How many 30 minute increments did you stay?\n'); if hour>=11 disp('If you stayed for 5 hours and 30 minutes or longer you are charged for an entire day, please go back and follow directions.') elseif hour<11 cost=(hour)*3.00; fprintf('You owe %.001f dollars. Thank you.\n',cost) end
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/27/2011 for the course BIO 101 taught by Professor Martin during the Spring '08 term at Rutgers.

Page1 / 2

Homework2 - %Code for parking receipt clear;clc disp'Please use whole numbers while answering the questions do not use decimals round up to the

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online