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

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

View Full Document Right Arrow Icon
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: ')
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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

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 Right Arrow Icon
Ask a homework question - tutors are online