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
Problem Statement: You are building an application that allows registered users to
create a pie chart or a line graph.
Before You Begin
Create an mfile with the filename lastNamePracm
No variable names are provided but you are expected to name all necessary
variables according to the rules and conventions discussed in class.
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.
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 Section X
YOUR NAME
Student ID
Coding Practical
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 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 l
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
