Question: Write a C++ program that inputs a maximum of 50 records from a sequential file. The program should insert the records into an ordered (maintain
Write a C++ program that inputs a maximum of 50 records from a sequential file. The program should insert the records into an ordered (maintain order at all times) array (ordered by Last_name in alphabetical order) based on the sample input file (employee.dat). Then print the records in ordered by last name.
Here is the contents of the input file (employee.dat):
Williams Hank 09 12 1976 00 00 0000 120000.00 TE willaimshank@myemil.com Johnson Mary 07 15 1992 01 03 2020 78989.00 MD johnson.mary@myemail.com Allison Terry 08 17 1980 02 16 2016 45878.89 eg allisonterry@myemail.com Harrison Mody 01 01 2010 00 00 0000 98090.98 AC harrmody@myemail.com Bonds Betty 05 12 1990 09 12 2019 32398.89 TT Bondsbety@myemail.com
Below are the parameter to calculate an employee's annual retirement salary (based on their annual salary and years of service):
Years if service: 0 5 4.5% , 6 10 12.5%, 11- 15 30.85%, 16 20 45.9%, over 20 65.90% annual retirement salary.
Below are the department names and acronyms:
Department codes AC accounting, MD medical, EG engineering, TE technical, PP -physical plant, ST staff, LW legal, Rd research TT testing, QC -quality control.
Validate the data in each record before storing it in the data structure, any record found to be in error should be written to a file called "error.dat" along with the reason for the error.
Example of output for error file:
Error file Error Messages
Total number of error record 99
Use the following structure definition in the program:
Struct listnode {
char last_name [15];
char first_name[15];
unsigned start_month;
unsigned start_day;
unsigned start_year; // 4 digits
unsigned end_month; // 0 if still active
unsigned end_day; //0 if still active
unsigned end_year; // 0 if still active
float annual_salary;
string dept_code; // Note: may be entered in either upper or lower case (two characters)
string email_address[25];
}; // end structure
The report should display to the screen and look like this:
**************
Last Name: Smith
First Initial: J
Date of Hire: Dec. 10, 1990
Annual Salary: $45,000.00
Department: Law
Years of Service: 23
Predicted Monthly Retirement: $9,000.00
Total records read 999
Total records processed 999
Total error records 999
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
