Question: Coding Practical 4 Problem Statement: You are building an application that allows registered users to create a pie chart or a line graph. Before You

Coding Practical 4
Problem Statement: You are building an application that allows registered users to
create a pie chart or a line graph.
Before You Begin
1. Create an m-file with the filename lastName_Prac4.m.
2. No variable names are provided but you are expected to name all necessary
variables according to the rules and conventions discussed in class.
3. Download the UserDatabase.txt file.
a. This is the file you will use to store all usernames and passwords. The
usernames and passwords are separated by a space.
4. This practical is your chance to apply all of the concepts that we have went over
throughout the semester. If your code is substantially similar to another students,
you will be given a zero. If you use outside sources, they must be cited.
Getting Started
Include header comments formatted as show below, using your own name and
ID number. Failing to include the honor code or your name will result in a zero.
Failing to provide the other information in the header will result in a point
deduction.
% CSCI 251, Section X
% YOUR NAME
% Student ID 12345678
% Coding Practical 4
% Todays Date
% In keeping with the Honor Code of the School of Engineering, I certify that the
following work is substantially the result of my own efforts.
Program
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 l

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!