%% Lab 3: Selection Statements - Wednesday, 2016-02-10
% This lab will focus on selection statements and MATLAB's menu function.  
% When you have completed this exercise, please upload your published work
% to your cs130r directory.

%% Getting Started
% Let's assume that a user has input the value below into the variable
% ui. Run this section to initialize the variable.

ui = 23;

%% if Statement
% Now, write two if statements. The first should check if the variable ui  
% is greater than 15, and the second should check if the variable ui is 
% less than or equal to 15. Each statement should have an action that 
% prints the value of ui, and indicates which if statement was executed.


%% if-else Statement
% Let's assume that a user has input the value below into the variable ui.
% Write an if-else statement that tells the user if the character is before
% or after the letter 'm' in the alphabet. You can assume that the user
% will only enter a lowercase letter.

ui = 't';


%% Nested if-else Statements
% We would like to check if the user has entered the character a, b, or c.
% Write a nested if-else statement to check the variable ui, and tell the
% user which letter has been entered. Your statement should also indicate
% if neither a, b, nor c is entered.

ui = 'c';


%% if-elseif Statement
% Now, convert the previous nested if-else statement into an if-elseif
% statement.

ui = 'b';


%% switch Statement
% We can rewrite our if-elseif statement above as a switch statement. This
% provides a convenient way to perform a specific action when a variable
% matches one of several conditions. Check out the documentation on switch
% statements to find the syntax. Then, rewrite the if-elseif statement from
% above using this syntax.

ui = 'c';


%% menu Function
% The built-in menu function provides a convenient way to get user input.
% Run the code below to see the graphic prompt that it creates. Click a
% menu button and observe the value assigned to the variable ui. Now, write
% a switch statement to print out the selection made by the user.

ui = menu('Pick a fruit', 'apples', 'blueberries', 'cantaloupes');

