{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW3 - Create a program that reads in a color and then using...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #3: Advanced Decision Statements Reading: 3.4 Homework: This assignment will be done entirely in MATLAB. When asked for a “program” you should create an m-file (script). Be sure to turn-in the completed script along with any runs you are asked for. In addition, you need a flow diagram for each program. Turn problems in IN THE ORDER THEY ARE ASSIGNED. Each problem needs to be labeled so the TA can find your work. Do the following exercises from your textbook 1. 3.4 Test your code with the following weights: 1.1, 2.3, 5.6, 75 and 105 2. 3.11 Test your code with the following incomes: 3k, 15k, 30k, 55k and 100k Write a MATLAB script (m-file) that 3. Will act as part of a robotic recognition system. A robotic eye will read a color and then print an appropriate label according to the following table. Color Label Blue FROZEN STORAGE Green THAW AND USE IMMEDIATELY Yellow NON-HUMAN USE ONLY Red DESTROY If the color is unrecognized, the label “UNRECOGNIZED-DESTROY” should be printed.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Create a program that reads in a color and then using a SWITCH statement prints the ap-propriate label along with keeping track of the total number of each color. The robotic eye will recognize three cases for each color (i.e. For Red, robotic eye will recognize “R”, “red” or “RED”) so be sure to account for each case. Run the program for the following sequence of colors: R BLUE red yellow GREEN B B D RED Y ORANGE YELLOW blue R Y G Once you have completed the sequence, display the total of each of the 5 categories with an appropriate label (i.e. There were ? that were the color red) Hint: For each color you will need a variable that you set to zero before the sequence (i.e. N red = 0). As the sequence is input there should be code to increment each counter (i.e. N red = N red + 1;)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online