Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

% Function Name: nameGen % Inputs (1): - (cell) cell array containing first and

ID: 3651893 • Letter: #

Question

% Function Name: nameGen
% Inputs (1): - (cell) cell array containing first and last names and a
% a vector of numbers
% Outputs (1): - (cell) cell array of GT usernames
%
% Function Description:
% Given a nested cell array containing 2 cell arrays of first and last
% names and a vector of doubles, write a function called "nameGen" that
% creates a new cell array containing the corresponding GT usernames. The
% first nested cell array contains the first names, the second nested
% cell array contains the last names and the vector contains the
% numbers. The format for the GT usernames is below:
%
% 'First Letter of First Name + Last Name + Number'
%
% Note:
% - The output must be a cell array and each element must be a string.
% - The nested cells and the vectors are guaranteed to be the same
% length.
% - You may find the function 'num2str()' useful.
%
% Test Cases:
% in1 = {{'David','Kristin','Olfisayo'},{'Smith','Marsicano','Omojunken'},
% ...[6 7 1]};
%
% in2 = {{'Emilio','Adrianna','Timothy'},{'Salazar','Carter','Philip'},
% ...[3 35 3]};
%
% out1 = nameGen(in1);
% out1 => {'dsmith6','kmarsicano7','oomojunken1'}
%
% out2 = nameGen(in2);
% out2 => {'esalazar3','acarter35','tphilip3'}
%

Explanation / Answer

You're missing a ) at the end of your if statement's conditional. While it's not required, it's always a good idea to put the body of an if block on its own line, separate from the if statement itself. It makes it easier to find errors like this. Also, while JavaScript does not strictly require a semicolon at the end of each statement, it is always a good idea to include them for clarity. Edit: Dominic is correct. The id attribute needs to be unique. You're thinking of the name attribute, which is how sets of radio buttons are linked together. He's also right about you never actually calling the function gender(). When do you want the function to be called? There are a couple of reasons why this doesn't work. In your HTML you have two element with id attributes of "gender". This is invalid. Id attributes must have unique names. You never call your function so it never runs. Here's a working example to give you some ideas.