Question: Create a single script (.m file) to solve these problems. Unless directed otherwise, use meaningful variable names for each variable; do not use the default

Create a single script (.m file) to solve these problems. Unless directed otherwise, use meaningful variable names for each variable; do not use the default variable ans to store your results. For this project, suppress your output with semi-colons (;). Each problem should be in a separate cell, using the cell mode feature of MATLAB. Do not use loops for this project.

Problem 1 (15 points)

You meet a famous French chef. He recently opened a new restaurant, so he currently cannot afford to hire IT staff. Fortunately for him, he meets you and finds out that you are taking CMPSC 200. He hires you on the spot to create a menu system for him. C'est la vie!1

The entre choices the chef has on his menu are:

Beef

Sole2

The beef entre has the following starch choices:

Mashed potatoes

Smashed potatoes

The sole entre has the following starch choices:

Baked potato

French fries3

Since the chef is low on funds, no matter what choice a customer chooses of entre and starch, he or she will be served green beans as their vegetable.

The following desserts are available regardless of choice of entre or starch:

Penn State Creamery Ice Cream

Cherry Pie

None (i.e. the customer does not want dessert)

Create a series of menus to prompt the customer for their dinner selections. A different menu should pop up at each stage: selection of the entre, selection of the starch, and selection of the dessert (or lack thereof). Uses switches as your selection structures (i.e. do NOT use if statements). Note that since the availability of starch selections is dependent on the choice of entre, you should nest your starch menus and starch switches inside the entre cases as appropriate; only the starches available with a particular entre should display after the user has selected their entre. Since the choice of dessert is not dependent on the entre or starch choices, you can simply include that menu and switch outside of (and after) your entre and starch code.

Print the customers selections to the Command Window. Emulate the formatting of this sample run (assuming the user selected sole, french fries, green beans, and that they did not want dessert):

The customer selected: Sole, french fries, green beans, and no dessert.

A clever approach to printing the second line would be to use fprintf statements without the use of new lines ( ) until you reach the dessert portion of the code. Without the new lines, MATLAB will simply continue printing onto the same line. Be careful with where you place blank spaces, however, so that the line formats nicely. If you take this suggested approach, you may find it easiest to have fprintf statements in each of your cases of your switches.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!