The table below provides the location of an employees office

The table below provides the location of an employee\'s office based on the employee\'s last name. Assign floorNumber with the corresponding floor based on the user specified lastName. If lastName is not recognized, then assign floorNumber with -1. If lastName is \'Lovelace\', then floorNumber is 1. If lastName is \'MCNULTY\', then floorNumber is 3. function floorNumber = FindFloor(lastName) floorNumber = 0; end

Solution


function floorNumber = FindFloor(lastName)
floorNumber = 0 ;
if(strcmpi(lastName, \'Hooper\'))
floorNumber = 2
elseif (strcmpi(lastName, \'Lovelace\'))
floorNumber = 1
elseif (strcmpi(lastName, \'McNulty\'))
floorNumber = 3
elseif (strcmpi(lastName, \'Snyder\'))
floorNumber = 2
else
floorNumber = -1

end

s = FindFloor(\'Lovelace\')
disp(s)

 The table below provides the location of an employee\'s office based on the employee\'s last name. Assign floorNumber with the corresponding floor based on the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site