Work with structures, vector of structures, files, and formatting.
A company keeps its employee records in a file. Each line in the file includes a single employee record (id, first name, last name, & salary). Write a C++ program that prints a report of employee data. You are asked to process the data in the file by storing the records in a vector of structures. Your program must print the following report.
- All employee records.
- Find and print the total payroll.
Create a directory called Lab6 inside your 2400/Labs directory. Download the data file and store it in Lab6 directory.
Hints:
- Write a function to load the vector of structures.
- Write a function to print the report. Consider using setw.
o Combine the first and last name into a single string. This will make it easier to use setw.
- Write a function to calculate and return the total payroll.
Sample input:
1000 George Washington 10000
2000 John Adams 15000
1212 Thomas Jefferson 34000
1313 Abraham Lincoln 45000
1515 Jimmy Carter 78000
1717 George Bush 80000
Sample output:
Sorted by name
ID Name Salary
1000 George Washington $10000.00
2000 John Adams $15000.00
1212 Thomas Jefferson $34000.00
1313 Abraham Lincoln $45000.00
1515 Jimmy Carter $78000.00
1717 George Bush $80000.00
Total Payroll: $262000.00
Reviews
There are no reviews yet.