Question: Develop a mini-database system to manage employee information. Your database should allow users to insert, delete, modify and retrieve employee records. Initially all the data
Develop a mini-database system to manage employee information. Your database should allow
users to insert, delete, modify and retrieve employee records. Initially all the data in the database
is stored in an external file called office.db. When your database program starts, the data in
the file is loaded into a dynamically created array of employees first. Then a user interacts with
the array during your program execution. When the user decides to exit the program, the data in
the array (with all the current updates) is written into the external file (overwrite existing content).
Here are some information for completing this project.
1. Employee information should include first name, last name, SSN, birth date, Salary.
You should define a class according to below:
class Employee{
string firstName, lastName;
string ssn;
string birthday;
fload salary;
public:
// define contructors
Employee();
Employee(string fn, string ln, string ssn, char g, float s);
// define getter/setter for firstName, lastName, gender, salary
string getFirstName();
string getLastName();
string getSSN();
string getBirthDate();
float getSalary();
void setFirstName(string fn);
void setLastName(string ln);
void setSSN(string s);
void setBirthDate(string bd);
void setSalary(float sal);
}
2. Load/Store employee information. You should read database information from an external
file and store them into an array of employees at the beginning of your program. Before your
program ends, it will save information in the array to the same external file (overwrite its
current content). The external file is called employee.db.
You must implement the following functions to load/store employee information using
external file.
/* read database information from a data file and insert each employee information into an
array and return the pointer to the first element of the array. If the file is empty, or the
creation of Employee array fails, return NULL
*/
Employee* readDatabase(ifstream* & databaseFile);
/* write the information in the Employee array into an external data file.
*/
void writeDatabase(ofstream* & databaseFile, Employee* employeeList);
/* display the information in an array into console.
*/
void printDatabase(Employee* employeeList);
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
