Hello! I am practicing material for my class and decided to make a restaraunt program where you are welcomed to the restaraunt, asked which drink you want, and whichever drink you select the program should display to the user 'drink ' coming right up!' but it does not do this. I am tyrying to do this both for user drink and food selection. I am also asking the user if they would like to continue/have dessert, and am using both switch case and if,elseif,else statements. It just needs some tidying up that I cannot figure out. Thank you in advance for the help!
clcclearclose alldisp('Hello, welcome to Julize''s Restaraunt! Please take a seat.')pausedrinks=menu('Please select which drink you would like to get started!','Lemonade','Coke','Water','Tea','Sprite'); switch drinks case 'Lemonade' disp([drinks ' coming right up!']) drinks=1; case 'Coke' disp([drinks ' coming right up!']) drinks=2; case 'Water' disp([drinks ' coming right up!']) drinks=3; case 'Tea' disp([drinks ' coming right up!']) drinks=4; case 'Sprite' disp([drinks ' coming right up!']) drinks=5; end pause food=menu('What would you like to eat today?','Steak & Fries','Fish & Rice','Hamburger & Fries','Shrimp & Rice'); switch food case 'Steak & Fries' disp([food ' coming right up!']) food=1; case 'Fish & Rice' disp([food ' coming right up!']) food=2; case 'Hamburger & Fries' disp([food ' coming right up!']) food=3; case 'Shrimp & Rice' disp([food ' coming right up!']) food=4; end pause answer=questdlg('Would you like dessert tonight?','Hello','Yes please','No thank you','We are good for the night','No thank you'); if answer==1 desserts=menu('What dessert can I interest you in?','Chocolate Cake & Ice Cream','Skillet Cookie & Ice Cream','Fried Banana & Ice Cream'); switch desserts case 'Chocalate Cake & Ice Cream' disp([desserts ' coming right up!']) desserts=1; case 'Skillet Cookies & Ice Cream' disp([desserts ' coming right up!']) desserts=2; case 'Fried Banana & Ice Cream' disp([desserts ' coming right up!']) desserts=3; end elseif answer==2 disp('I''ll bring you your check.') dessert=0; else answer=3 disp('I''ll bring you your check.') dessert=0; end pause disp('Thank you for coming to eat at Julize''s Restaraunt!. We will see you next time!')
Best Answer