Question
Write a C++ program that inputs records from a file called employee.dat, insert the records into a sorted array (sorted by Last_name in alphabetical order),
Write a C++ program that inputs records from a file called employee.dat, insert the records into a sorted array (sorted by Last_name in alphabetical order), and print the records in order 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@mymail.com Johnson Mary 07 15 1992 01 03 2020 78989.00 MD johnson.mary@mymail.com Allison Terry 08 17 1980 02 16 2016 45878.89 EG allisonterry@mymail.com Harrison Mody 01 01 2010 00 00 0000 98090.98 AC harrmody@mymail.com Bonds Betty 05 12 1990 09 12 2019 32398.89 TT Bondsbety@mymail.com Charlie Reed 04 03 1995 12 11 2018 123455.90 RD charlieReed@mymail.com Oman Nelson 09 23 1987 12 11 2024 34398.89 QC Omanndnelson@mymail.com Kelly Polk 08 01 2020 00 00 0000 39399.98 ST kelly.polk@mymail.com Mack Ron 09 01 2017 02 30 1998 29828.98 MD mack_ron@mymail.com Zack Nelson 09 14 1997 05 05 1217 18892.90 TT zack_ron@mymail.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:
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
record 99 < start date month error 13/22/89
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:
Employee Report 08/31/2021
**************
Last First Date of Annual Department Years Predicted/monthly
Name Initial Hire salary Title of service* Retirement
Smith J. Dec. 10, 1990 $45,000.00 Law 23 $9999.99
Williams K. Jan. 19, 1990 $23,500.00 Med 24 $9999.99
etc.
Total $999,999.99 $9999.99
Total records read 999
Total records processed 999
Total error records 999
*Service should be rounded to the nearest year
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