Your company has asked you to develop a report detailing payroll information wit
ID: 3673912 • Letter: Y
Question
Your company has asked you to develop a report detailing payroll information with the following format:
Acme Corporation
Number of Employees: 3
Average Salary: 53,502.32
Annual Total: 160,506.95
Name Rank Salary
Jones, William B2 42,500.00
Baker, Susan A3 65,000.00
Baer, Teddy B4 53,006.95
Develop an Employee class that contains first name, last name, rank, and salary. The class should have the following methods:
parameterized constructor
getters necessary for printing the report
formatName() method that returns a String with the name in the format last, first
Employee information is stored in a sequential text file named employees.txt. The file has the format:
employees.txt file: text file with the following fields separated by spaces:
Fields
Description
First Name
string
Last Name
string
Rank
string
Salary
double
Note: Names will not contain spaces.
Write a program named Prog5 that reads employee information from the file and places a corresponding Employee object into an array. After the file has been read, print the report shown above using proper formatting.
Acme Corporation
Number of Employees: 3
Average Salary: 53,502.32
Annual Total: 160,506.95
Name Rank Salary
Jones, William B2 42,500.00
Baker, Susan A3 65,000.00
Baer, Teddy B4 53,006.95
Explanation / Answer
#include class employee { char firstName[50]; char lastName[50]; int salary; char rank[20]; public: employee() { strcpy(firstName, "NULL"); strcpy(lastName, "NULL"); strcpy(rank, "NULL"); salary=0; } employee (string p,string q,int r,string s) { strcpy(firstName, "p"); strcpy(lastName, "q"); strcpy(rank, "s"); salary=r; } void setfirstname() { coutfirstName; } void setlastname() { char ln; coutlastName; } void setsalary() { int z; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.