Below is part of the \'Bbq Pizza\' menu. Apply menu function from Matlab, write
ID: 3588494 • Letter: B
Question
Below is part of the 'Bbq Pizza' menu. Apply menu function from Matlab, write a programme
1) After asking the type of pizza wanted,
2) Choosing the size of pizza (Regular/Large)
in sequence, show the actual price of pizza information inputted. If none of the pizza is chosen and the menu bar is closed, then output will be 0.
Menu:
Potato pizza Regular $11.99 Large $15.99
Beef pizza Regular $10.99 Large $14.99
Vege pizza Regular $9.99 Large $13.99
Pepperoni pizza Regular $9.99 Large $13.99
Cheese pizza Regular $8.99 Large $12.99
Explanation / Answer
Code:
fprintf("1)Potato pizza Regular $11.99 Large $15.99 2)Beef pizza Regular $10.99 Large $14.99 3)Vege pizza Regular $9.99 Large $13.99 4)Pepperoni pizza Regular $9.99 Large $13.99 5)Cheese pizza Regular $8.99 Large $12.99");
n = input(" enter type of pizza(1/2/3/4) : ")
size=input(" Enter size(regular/large) : ")
switch n
case 1
if strcmp(size,'regular')
fprintf(" Bill : $11.99")
elseif strcmp(size,'large')
fprintf(" Bill : $15.99")
else
fprintf(" Invalid size")
end
case 2
if strcmp(size,'regular')
fprintf(" Bill : $10.99")
elseif strcmp(size,'large')
fprintf(" Bill : $14.99")
else
fprintf(" Invalid size")
end
case 3
if strcmp(size,'regular')
fprintf(" Bill : $9.99")
elseif strcmp(size,'large')
fprintf(" Bill : $13.99")
else
fprintf(" Invalid size")
end
case 4
if strcmp(size,'regular')
fprintf(" Bill : $9.99")
elseif strcmp(size,'large')
fprintf(" Bill : $13.99")
else
fprintf(" Invalid size")
end
otherwise
fprintf(" Bill : 0")
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.