Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROBLEM: Techi Gadgets Account Program. ( 2 0 pts ) Write the Techi Gadgets Account Program. The program will read a text file containing the

PROBLEM: Techi Gadgets Account Program. (20 pts)
Write the Techi Gadgets Account Program. The program will read a text file containing the following
account data:
AccountData.txt (placed in a 2D array format):
[0][1][2][3][4][5][6]
[0] bham@gnet.com Blake Ham squid621987 U Teacher
[1] jdark@att.net Jim Dark gymrat321985 A Master
[2] hgreen@lakes.net Hannah Green flower222007 U Apprentice
[3] tsmith@dna.com Tom Smith tuna202000 U Teacher
[4] jarrow@pnet.com James Arrow ahoy102005 U Apprentice
Column [0] will represent the user id, column [1] the users first name, column [2] the users last name,
column [3] the users password, column [4] the users initial membership year, column [5] the users
account access, U- General User and A Administrator, and column [6] the users tech status,. An
Administrator will have the right to view all the user accounts; the output must be sorted in alphabetic
order by last name (see sample output) when viewed by the Administrator. General Users will be able
to view their membership year and tech status.
When the Administrator views the user accounts, the data is automatically backed up to an output text
file named sortedBackup.txt.
HOW THE PROGRAM WORKS:
The program will first read in the file then ask the user to input their user name and password.
Depending on their account access, A or U, the program will display a welcome message with their
name, their initial membership year, their account access and their tech status if they are a General
User, if they are an Administrator, the program will display all the users in alphabetical order and also
backup the data file in alphabetical order to an output file called sortedBackup.txt. The program will
then loop back around and ask for the user name and password again, the program must reset the
username and password so that the last username and password used cannot be reused in the loop by
default. The user may type zero to exit. Please note that the user may type zero at any time to exit the
program.
Your program MUST use input validation.
Input Validation: The program must check to see if the input file exists, if the input file does not exit it
must print an error message and exit the program correctly.
Note: The Account Data text file is given to you in Blackboard within your Homework Folder.
PSEUDO-CODE for main function (one of many ways you can do your program):
A. Declare Necessary Variables and 2D array to store data from input file.
B. Call the readFile function and capture the returned value.
C. Test if file was successfully read if so continue with program else exit with error message.
D. Do while....
a. Ask user to Enter User Name or Zero to Exit
b. Read in User Name
c. If User Name read in is zero Exit program.
d. Ask the user to Enter Their Password or Zero to Exit
e. Read in User Password
f. If User Password read in is zero Exit program
g. Call the Validate User function and capture the returned value
h. 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
i. Else if returned value Not Valid from the Validate User function, FALSE, output message
username and password invalid
CONSTRAINTS:
No global variables allowed. (Automatic -10)
Note: This means that all your arrays must be declared inside of main.
You must use: int main()
You must use input validation.
The program must use local variables. (2 pts)
You must use functions and they must be called by main. (2 pts)
Output must be formatted properly and correct. (3 pts)
Include a comment at the beginning of the program stating the purpose of the program, your
name, the date, and your class (1pt is for code organization and use of whitespace).(3 pts)
The program must read in data from an input file. (2 pts)
The program must output the results both to the console and to an output file. (1 pts)
This program MUST use the following functions: (7 pts)
NAME YOUR FUNCTIONS AS SHOWN BELOW (-10 if not named correctly):
void showAll (string theAccounts[5][7])-(1 pts) is passed.the array which stores all the account data and prints all the account data. This function returns nothing.
void sortInput (string theAccounts[5][7])-(2 pts) is passed the array which stores all theaccount data and sorts the account data by last name. This function returns nothing.
bool validateUser (string theAccounts[5][7], string username, string password, int &saveRow); -(2 pts) is passed the array which stores all the account data, the user name, the user entered password and the reference to an integer to save the row where the user account will be found in the function. The function checks to see if the user name entered and the password matches, then returns true or false. It also saves the row where it found the user information in saveRow.
bool readFile(string theAccounts[5][7])-(2 pts) is passed the array which will store all

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions