Question: 3.3 and 3.4. please use MATLAB 3.3 A customer can order lunch from a menu: Fish and Chips $24 Hamburger $21 Pizza $15 Sushi $18
3.3 A customer can order lunch from a menu: Fish and Chips $24 Hamburger $21 Pizza $15 Sushi $18 (a) Construct MATLAB code that will prompt his or her choice, read in the choice, and output the choice ordered as the case expression for a switch construct. Also output the cost of choice payment. Be sure to include a default case to handle invalid inputs. Testing three cases: (1) Sushi (2) Fish and Chips (3) Fried Rice. Show the code and the testing results. (b) Rewrite the above program by using the "menu" function to choose. Place the title as "Choose an item". Test two cases: (1) Hamburger (2) Pizza. (Hint: Do not store the file as menu.m. Try other filename.) Show the code, the menu interface in your answer, and the testing results. 3.4 (a) Use a while-end loop in a script file to calculate the sum of the first n terms of the series: (5k +k). Store all the first n reslts in an array y, and let n = 20. Show your code and the array y. (b) Use a for-end loop in a script file to calculate the sum of the first n terms of the series: (k-k). Store all the first n reslts in an array y, and let n = 15. Show your code and the array y. kal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
