ABCs_conditionals

# ABCs_conditionals - % y is eqaul to 'Cedric' or 'David',...

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

Sheet1 Page 1 function [A B C D] = ABCs_conditionals(x, y, z) % PROBLEM 4. The ABCs of Conditionals % % This is a multi-part problem. Do each of the parts below. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % a) if statements. x is a number. Use an if statement to set A equal to % one of the following strings: 'positive', 'zero', or 'negative' depending % on whether x is positive, zero, or negative. Note that you must use an % if statement and your answer should be stored in a variable named A. % % Write your code here: if x > 0 A = 'positive' elseif x == 0 A = 'zero' elseif x < 0 A = 'negative' end % b) switch statements. The variable y may be equal to one of the % following strings: 'Jacey', 'Andre', 'Taylor', 'Cedric', or'David'. If y % is equal to 'Jacey', 'Andre', or 'Taylor', your answer should be 'TA'. If
This is the end of the preview. Sign up to access the rest of the document.