Question
Using C write a user-interface which allows the user a menu of choices for a bank database application. The database contains the accountnumber (int), name
Using C write a user-interface which allows the user a menu of choices for a bank database application. The database contains the accountnumber (int), name (char [ ]), and address(char [ ]) fields for each person. For more details, see the following requirements below.
Assume that the information is stored in a database which is a black box and can only be accessed by the functions, addRecord, printRecord, printAllRecords and deleteRecord, which have the following prototypes:
int addRecord (struct record **, int, char [ ],char [ ]); int printRecord (struct record *, int); void printAllRecords(struct record *); int deleteRecord(struct record **, int);
Do not implement or complete the above functions. They are stubs at the moment, and will be implemented in later assignments. (if you don't know what "stub" means, go research!)
The following menu choices must be available:
Add a new record in the database
Print information about a record using the accountno as the key
Print all information in the database
Delete an existing record from the database using the accountno as a key
Quit the program
You must use a while or do-while loop for the menu.
For each menu option, collect the appropriate information from the user (including an account number).
Write your own getaddress function to obtain the address information
the address field may have multiple lines of address
It must be stored as one character array
You CANNOT ask the user how many lines of address they are going to type
Prototype for the function is
void getaddress (char [ ], int);
The name entered by the user may have spaces.
Source Files
the stubs, representing database functions, must be defined in a separate file.
All stubs must be in one source file and the user-interface functions in one or more files.
DO NOT DEFINE a structure or array to hold the entire database, but use the following structure as a separate, record.h file
struct record { int accountno; char name[25]; char address[80]; struct record* next; };
Define the following items:
struct record * start; start = NULL;
and pass it or its address to the database functions.
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