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 3 or step 4 isnt detailed enough)
1. Include the commands to clear the workspace and command window.
2. 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 pre-defined function of your choice.
3. 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.
4. Using an I/O 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 8 starter code shows a quick and easy way of doing this.
5. Check if the user entered sign up.
6. If the user selected sign up, prompt them to enter a username with at least four
characters and no spaces.
7. Create a user-defined function that checks if the username is invalid (has less
than four characters and or spaces).
a. The user-defined 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.
8. Call the user-defined function from step 7 and assign it to an actual output
argument.
9. Create a user-defined function that checks if the username already exists within
the array of usernames you created in step 4.
a. The user-defined 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.
10.Call the user-defined function from step 9 and assign it to an actual output
argument.
11.Using the values returned from the function calls in step 8 and 10, create a while
loop that continues to re-prompt 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.
12.Below the while loop from step 11, prompt the user to enter a password with at
least six characters and no spaces.
13.Create a user-defined function that checks if the password entered is valid (at
least six characters and no spaces).
a. The user-defined 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.
14.Call the function from step 13 and assign the returned value to an actual output
argument.
15.Using the values returned from the function call in step 14, create a while loop
that continues to re-prompt the user for a password until it is valid.
16.Below the while loop from step 15 print the statement New user created.
17.Using an fprintf function, write the new username and password to the
UserDatabase.txt file.
18.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 pre-defined function of your choice.
19.If they enter yes, reassign the variable from step 2 to the character vector login. If
they enter no, use a return statement to end the program.
20.Check if the variable from step 2 is assigned login.
21.If the variable is assigned the character vector login, prompt the user to enter
their username and password (separate prompts).
22.Create a user-defined function, that checks if there is a user with that username
and password.
a. The user-defined 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.
23.Call the function from step 22 and assign the returned value to an actual output
argument.
24.Using the values returned from the function call in step 23, create a while loop
that continues to re-prompt the user for a username and password until a match
is found. Output Successfully Login.
25.Using the value r

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!