HW6 #2

# HW6 #2 - Function call[tip15 tip20 total15 total20 =...

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

Sheet1 Page 1 %Engineering 6, Spring 2004, Problem 6.2 %Ryan Uy, 2509 %Section B05, Tues. 3-4 % rcu6_2.m % Prompts the user to enter the cost of a meal and then calls the % rcu_mealcost function to calculate two tip amounts, 15% and 20%, % and the total amounts due in each case (i.e., meal price plus tip). That % is, the function will return four values and assign them to the % following varaibles: % tip15 = tip at 15% % tip20 = tip at 20% % total15 = total price at 15% tip % total20 = total price at 20% tip % Get a user input for the price of a meal price = input('Enter a meal price in dollars and cents: ')

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Function call [tip15 tip20 total15 total20] = rcu_mealcost(price) fprintf('Price of meal: \$%.2f\n',price) fprintf('15 percent tip: \$%.2f\n',tip15) fprintf('20 percent tip: \$%.2f\n',tip20) fprintf('Total price with a 15 percent tip: \$%.2f\n',total15) fprintf('Total price with a 20 percent tip: \$%.2f\n',total20) Sheet1 Page 2 create variables for each return value and input price %print price of meal %print price of 15% tip %print price of 20% tip %print total price with 15% tip %print total price with 20% tip...
View Full Document

## This note was uploaded on 01/22/2011 for the course ENG 006 taught by Professor Lagerstrom during the Spring '06 term at UC Davis.

### Page1 / 2

HW6 #2 - Function call[tip15 tip20 total15 total20 =...

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

View Full Document
Ask a homework question - tutors are online