Answered step by step
Verified Expert Solution
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. pts
Write the Techi Gadgets Account Program. The program will read a text file containing the following
account data:
AccountData.txt placed in a D array format:
bham@gnet.com Blake Ham squid U Teacher
jdark@att.net Jim Dark gymrat A Master
hgreen@lakes.net Hannah Green flower U Apprentice
tsmith@dna.com Tom Smith tuna U Teacher
jarrow@pnet.com James Arrow ahoy U Apprentice
Column will represent the user id column the users first name, column the users last name,
column the users password, column the users initial membership year, column the users
account access, U General User and A Administrator, and column 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 sortedBackuptxt 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.
PSEUDOCODE for main function one of many ways you can do your program:
A Declare Necessary Variables and D 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
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. pts
You must use functions and they must be called by main. pts
Output must be formatted properly and correct. pts
Include a comment at the beginning of the program stating the purpose of the program, your
name, the date, and your class pt is for code organization and use of whitespace pts
The program must read in data from an input file. pts
The program must output the results both to the console and to an output file. pts
This program MUST use the following functions: pts
NAME YOUR FUNCTIONS AS SHOWN BELOW if not named correctly:
void showAll string theAccounts 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 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 string username, string password, int &saveRow; 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 readFilestring theAccounts pts is passed the array which will store all
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started