HW04_soln

HW04_soln - else charge = 5.00 0.05*100 0.025(230...

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

>> type column sr = input('Please enter Slimness Ratio: '); if sr < 100 sl = 16500 - 0.475*sr^2; else sl = 17900/(2+sr^2/17900); end fprintf('\n'); fprintf('Slimness Ratio = %.1f\nSafe Load = %.0f psi\n',sr,sl); >> column Please enter Slimness Ratio: 89 Slimness Ratio = 89.0 Safe Load = 12738 psi >> column Please enter Slimness Ratio: 121 Slimness Ratio = 121.0 Safe Load = 6352 psi

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

View Full Document
>> type gas_meter begin = input('Enter Beginning Reading (4 digits): '); stop = input('Enter Ending Reading (4 digits): '); if (stop > begin ) use = stop - begin; else use = (10000+stop) - begin; end if ( use <= 70 ) charge = 5.00; elseif (use <= 170 ) charge = 5.00 + 0.05*(use - 70); elseif (use <= 400 ) charge = 5.00 + 0.05*100 + 0.025*(use-170);
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else charge = 5.00 + 0.05*100 + 0.025*(230) + 0.015*(use-400); end fprintf('\n'); fprintf(' Present Reading: %4i\nPrevious Reading: %4i\n',stop,begin); fprintf(' Use: %4i\n\n',use); fprintf(' Charge: \$%.2f\n',charge) >> gas_meter Enter Beginning Reading (4 digits): 7401 Enter Ending Reading (4 digits): 7831 Present Reading: 7831 Previous Reading: 7401 Use: 430 Charge: \$16.20 >> gas_meter Enter Beginning Reading (4 digits): 7550 Enter Ending Reading (4 digits): 7831 Present Reading: 7831 Previous Reading: 7550 Use: 281 Charge: \$12.78 >> gas_meter Enter Beginning Reading (4 digits): 9997 Enter Ending Reading (4 digits): 0103 Present Reading: 103 Previous Reading: 9997 Use: 106 Charge: \$6.80...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

HW04_soln - else charge = 5.00 0.05*100 0.025(230...

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

View Full Document
Ask a homework question - tutors are online