clc %clear command
clear %clear workspace
Roster = []
%Infinite while-end loop (1 == True)
while (1)
%Create a menu of options. (Steps 1-2) (Given in the homework)
fprintf('\n1 - Enter Names In Roster \n');
fprintf('2 - Quit \n');
%Input a choice number (1-4 for menu)
choice = input('\n Please enter your choice:');
switch choice%Switches to choice case
%The user selects an option and the system displays the corresponding result/function (Given to us in the lab)
case 1
Roster = input('Please enter a [first_name, blank, last_name] using the char function:');
Roster
%For case 2, it breaks and displays "Quitting"
case 2
fprintf('Quitting! \n'); %Print message "Quitting!"
break
%If the user enters a value outside the [1 2] range, the system displays the error message "Invalid Entry"
%Could also use disp('Invalid Entry')
otherwise
%If input any number that isn't (1 to 2) Then display (Invalid
%Option) and go back to the main menu
disp('invalid option')
end
end
+ I need help if I am doing this right, I think I have the menu down, and you have to enter the names as a string. e.g: char('bob dylan',walt disney')
But now i have a problem, how do I re arrange the names that so it will display lastname firstname. Originally the user types in firstname lastname. (use slicing and concatenation is a hint)
next I need to know how to make the uppercase of the initials....
After that I should be set in trying to do the homework. It's due on March 29, but I need to understand it since i have an exam on thursday April 1