Question: For each unified block of code add a comment explaining the code ( doesn t have to be multiple sentences but step 3 or step
For each unified block of code add a comment explaining the code doesnt have to be
multiple sentences but step or step isnt detailed enough
Include the commands to clear the workspace and command window.
Prompt the user to enter whether they would like to sign up or login
a Standardize the output by converting the input to all uppercase or
lowercase letters using a predefined function of your choice.
Programmatically open the UserDatabase.txt file.
a You will be reading from and writing to the file. Also, you do not want to
recreate the file each time it is opened.
Using an IO function of your choice, create an array of the usernames and a
separate array of the passwords within the userDatabase.txt file.
a The lab starter code shows a quick and easy way of doing this.
Check if the user entered sign up
If the user selected sign up prompt them to enter a username with at least four
characters and no spaces.
Create a userdefined function that checks if the username is invalid has less
than four characters and or spaces
a The userdefined function should use the username entered by the user
as the input argument and a logical variable representing whether the
username is invalid as the output argument.
Call the userdefined function from step and assign it to an actual output
argument.
Create a userdefined function that checks if the username already exists within
the array of usernames you created in step
a The userdefined function should use the username entered by the user
and the array of usernames as the input arguments and a logical variable
representing whether the username is new as the output argument.
b To check if the username already exists iterate the array of usernames
and check if each username within the array is the same as the username
entered by the user. Once you find the username already exists you no
longer need to continue to iterate there is a statement that terminates the
loop completely and can assign a value to the output argument
accordingly.
Call the userdefined function from step and assign it to an actual output
argument.
Using the values returned from the function calls in step and create a while
loop that continues to reprompt the user for a username until it is valid and
doesnt already exist.
a Structure the loop condition properly. Remember the while loop will
continue to iterate until the condition returns false.
Below the while loop from step prompt the user to enter a password with at
least six characters and no spaces.
Create a userdefined function that checks if the password entered is valid at
least six characters and no spaces
a The userdefined function should use the password entered by the user as
the input argument and a logical variable representing whether the
password is invalid as the output argument.
Call the function from step and assign the returned value to an actual output
argument.
Using the values returned from the function call in step create a while loop
that continues to reprompt the user for a password until it is valid.
Below the while loop from step print the statement New user created.
Using an fprintf function, write the new username and password to the
UserDatabase.txt file.
Prompt the user to indicate if they would now like to login by entering yes or no
a Standardize the output by converting the input to all uppercase or
lowercase letters using a predefined function of your choice.
If they enter yes, reassign the variable from step to the character vector login If
they enter no use a return statement to end the program.
Check if the variable from step is assigned login
If the variable is assigned the character vector login prompt the user to enter
their username and password separate prompts
Create a userdefined function, that checks if there is a user with that username
and password.
a The userdefined function should use the username entered by the user,
the array of usernames, the password entered by the user, and the array
of passwords as the input arguments and a logical variable representing
whether a user with that username and password exists.
b To do this iterate the array of usernames and passwords they should be
the same length so a single loop variable can be used to access the
elements in both arrays for each pair of usernames and passwords check
if the user entered username AND password match. Once a match is
found, you no longer need to continue to iterate there is a statement that
terminates the loop completely and can assign a value to the output
argument accordingly.
Call the function from step and assign the returned value to an actual output
argument.
Using the values returned from the function call in step create a while loop
that continues to reprompt the user for a username and password until a match
is found. Output Successfully Login.
Using the value r
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
