fix all errors in code below: PLEASE DO ASAP, THIS IS IN MATLAB %Welcome Message fprintf('****Welcome to Comida...

60.1K

Verified Solution

Question

Programming

fix all errors in code below: PLEASE DO ASAP, THIS IS INMATLAB

%Welcome Message

fprintf('****Welcome to Comida Mexicana De Mentiras****\n');

flag =0;

while flag ==1

% Asking the user for the order

choice = input('Please enter your order \n 1. Burrito Bowl \n2.Burrito \n 3. Tacos \n Enter 1 or 2 or 3: ','s'); switchchoice

case choice==1

% For Burrito Bowl

BaseCost = 4;

[Protein, PC] = proteinChoice();

[FinalAmount,~]= AmountCalculator(BaseCost,PC);displayMessage(\"Burrito Bowl\",Protein,FinalAmount);

case choice==2

end

end

% For Burrito

BaseCost = 5;

[Protein, PC] = proteinChoice(); [FinalAmount,~] =AmountCalculator(BaseCost,PC);displayMessage(\"Burrito\",Protein,FinalAmount);

for proteinChoice == 3 % For Tacos

BaseCost = 3;

[Protein, PC] = proteinChoice(); [FinalAmount,~] =AmountCalculator(BaseCost,PC);displayMessage(\"Tacos\",Protein,FinalAmount);

else

%If the user enters a choice which is not 1, 2 or 3

fprintf('Please enter a valid choice \n');

% Giving the user an option to re-enter their order

flag = input('Would you like to re-enter your order? Enter 1 foryes and 0 for no:\n');

end

% This zero input, two output function is used to get the user'sprotein

% choice

function [Protein,PC] = proteinChoice()

Protein_Option = input('Enter your choice of Protein: \n 1.Chicken \n 2. Steak \n 3. Carnitas \n 4. Sofritas \n 5. Veggie\n');

% PC refers to Protein cost, which is the cost of the proteinadd on switch Protein_Option

case 1

PC = 2;

Protein

case 2

PC = 2;

Protein

case 3

PC = 2;

Protein

case 4

PC = 1;

Protein

case 5

= \"Chicken\"; = \"Steak\";

= \"Carnitas\"; = \"Sofritas\";

PC = 0;

Protein = \"Veggie\";

% The following two input, one output function is used tocalculate the

% total cost including tax for the order.

function FinalAmt = AmountCalculator(BC,PC)

% CostAdder and TaxCalc are anonymous functions

% The calculations in the following anonymous functions arecorrect, but

% the syntax is not.

@CostAdder = (x) sum(x);

@TaxCalc = (x) 0.075*x; % Assuming a 7.5% tax rate

TotalCost = CostAdder([BC,PC]);

Tax = TaxCalc(TotalCost);

FinalAmt = CostAdder([TotalCost, Tax]);

end

% This three input, zero output function is used to display thetotal cost

% to the user.

function displayMessage(BaseOrder,Protein,FA)

disp(' Your %f %f cost $%.2f\n',Protein,BaseOrder,FA); end

Answer & Explanation Solved by verified expert
4.0 Ratings (701 Votes)
clcWelcome MessagefprintfWelcome to Comida Mexicana De Mentirasnflag 1while flag 1 Asking the user for the orderchoice inputPlease enter your order n 1 Burrito Bowl n2Burrito n 3 Tacos n Enter 1 or 2 or 3 sswitch choicecase 1 For Burrito BowlBaseCost 4Protein PC proteinChoiceFinalAmount AmountCalculatorBaseCostPCdisplayMessageBurrito BowlProteinFinalAmountcase 2 end For BurritoBaseCost 5Protein    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students