Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is matlab problems. Can you do it and send me codes thanks. mytipcalculator

ID: 3209973 • Letter: T

Question

This is matlab problems. Can you do it and send me codes thanks.



mytipcalculator.m Write a script called "mytipcalculator.m" that asks the user for the total cost of a meal (bill) and the number of people in the group (party) The tip should be calculated as 15% for a party less than or equal to six people, 18% for a party less than or equal to eight, 20% for a party less than or equal to 11, and 25% for a party 11 or more. To write you program, use the elseif operator. Check your code: >> mytipcalculator what is the total bill? 79 how many people are in your party?5 your calculated tip is $11.85 >> mytipcalculator what is the total bill? 187 how many people are in your party? 9 your calculated tip is $37.40

Explanation / Answer

mytipcalculator.m

close all
clear
clc

bill = input('what is the total bill? ');
num_people = input('how many people are in your party? ');
if num_people <= 6
tip = 15;
elseif num_people <= 8
tip = 18;
elseif num_people <= 11
tip = 20;
else
tip = 25;
end
fprintf('your calculated tip is $%.2f ', tip*0.01*bill);

sample output

what is the total bill? 79
how many people are in your party? 5
your calculated tip is $11.85

exptaylorseries.m

close all
clear
clc

x = input('enter a value of x: ');
actual = exp(x);
tol = 0.00001;
s = 0; n = 0;
while 1
s = s + x^n/factorial(n);
if abs(actual - s) <= tol
fprintf('the difference between the actual value exp(x) and the Taylor Series expansion is %.12f ', abs(actual - s));
fprintf('the loop iterated %d times ', n);
break;
end
n = n + 1;
end

sample output

enter a value of x: 16
the difference between the actual value exp(x) and the Taylor Series expansion is 0.000007281080
the loop iterated 51 times

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote