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

I guessed when I initially turned in the assignment and was luckily correct. Ple

ID: 2291833 • Letter: I

Question

I guessed when I initially turned in the assignment and was luckily correct. Please show me where to change everything correctly. I did not find it in my notes when I was reviewing everything.

Problem-2: Debugging and Case-Switch Statement (MATLAB) (20pts) The MATLAB program below is written using if-elseif-else statement and contains several syntax errors. Your goal is to first fix the errors for the code to run properly and then convert it to a case-switch statement. %This script asks the user for a type of pizza % and prints which type to order using if-else while 1 mypick = menu ('Pick a pizza', 'Cheese', 'Shroom', 'Sausage', 'No Pizza'); if mypack == 1 disp('Order a cheese pizza!') elsif mypick == 1 disp ('Order a mushroom pizza!') elseif mypick = 3 disp ('Order a sausage pizza!') elseif disp('No pizza for us today!') disp('Addio!!') break; end end end

Explanation / Answer

Correct program

while 1
        mypick= menu('Pick a pizza', ' cheese', 'shroom', 'Sausage', ' No pizza');

if mypick ==1             % here mypick in place of mypack
          disp('Order a cheese pizza! ')
elseif mypick ==2    % here is change put 2 in place of 1
      disp('Order a mushroom pizza! ')

elseif mypick == 3
          disp('Order a sausage pizza! ')

elseif
        disp('No pizza for us today ')
        disp('Addio!!')
        break;

end

end