

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Problem Statement: The computer will create all of the variables, make the array, take the info from the given file and put it into the array, ask for the username, ask for the password, find the correct account, output the correct screen if ,depending on the user, they have general user (U) access or administrator access (A), it will print out a different screen. For the U access it just shows their info and that is it. For the A access it shows all accounts, and prints it to a backup file. Then it will restart until the user types โ0โ for their username or password. Sample Softcopy: Enter the following info or 0 to exit Please enter your username : [email protected] Please enter your password : gymrat [email protected] James Arrow ahoy10 2005 U Apprentice [email protected] Jim Dark gymrat32 1985 A Master [email protected] Hannah Green flower22 2007 U Apprentice [email protected] Blake Ham squid62 1987 U Teacher [email protected] Tom Smith tuna20 2000 U Teacher Enter the following info or 0 to exit Please enter your username : 0 Thank you for using Techi Gadgets Account Program. Constant list: DNE Variable/array list: โ theAccounts[5][7] โ username โ password โ saveRow โ swapped โ i โ j Pseudocode:
Declare Necessary Variables and 2D array to store data from input file. Call the readFile function and capture the returned value. Test if file was successfully read if so continue with program else exit with error message. Do whileโฆ. Ask user to Enter Username or Zero to Exit Read in Username If the Username read in is โzeroโ Exit program. Ask the user to Enter Their Password or Zero to Exit Read in User Password f. If User Password read in is โzeroโ Exit program Call the Validate User function and capture the returned value If returned value from the Validate User function is TRUE continue program to check access code if U or A i. If U โ code appropriately ii. If A โ code appropriately Else if returned value Not Valid from the Validate User function, FALSE, output message username and password invalid Data tracing chart:
| Variable | Value | |------------------------------| | inFile | AccountData.txt | | username | User input | | password | User input | | theAccounts | Populated from AccountData.txt | | swapped | Boolean value | | i, j | Loop counters | | saveRow | Returned value from validateUser function | | inFile | Opened and checked for failure | | outFile | sortedBackup.txt |
Test Softcopy: See sample softcopy, or : Enter the following info or 0 to exit Please enter your username : [email protected] Please enter your password : gymrat [email protected] James Arrow ahoy10 2005 U Apprentice