Question: Gaddis intr main.cpp #include #include #include #include #include #include #include #include using namespace std; #include Employee.h #include HourlyEmployee.h #include SalaryEmployee.h // Global variables const int
Gaddis intr


main.cpp
#include
#include "Employee.h" #include "HourlyEmployee.h" #include "SalaryEmployee.h"
// Global variables const int EMPID_LENGTH = 7; // length of id is 6 const int FIRSTNAME_LENGTH = 12; // length of first name is less than 21 const int LASTNAME_LENGTH = 12; // length of last name is less than 21 const string EMPDATA_FILENAME = "employees.dat"; const string TIMEDATA_FILENAME = "emp_time.dat"; const string PAYROLL_REPORT_FILENAME = "payroll.txt";
struct EmployeeRecord { char employeeType; // H for hourly employee, S for salary employee char id[EMPID_LENGTH]; // Id of employee char firstName[FIRSTNAME_LENGTH]; // Employee's first name char lastName[LASTNAME_LENGTH]; // Employee's last name double salary; // Employee's weekly or hourly salary depending on type of employee };
struct EmployeeTime { char id[EMPID_LENGTH]; // ID of employee double hours; // Hours worked for week };
// Function declarations void loadEmployees(vector
int main() { vector
loadEmployees(employees, EMPDATA_FILENAME); loadEmployeeTime(timeCards, TIMEDATA_FILENAME); createPayrollReport(employees, timeCards, PAYROLL_REPORT_FILENAME); // Make sure we place the end message on a new line cout
// The following is system dependent. It will only work on Windows system("PAUSE");
/* // A non-system dependent method is below cout
/*************************************************************** Loads the employees from the file employees is a vector of pointers to Employee class fileName is the name of the file to read the data from ****************************************************************/ void loadEmployees(vector
/*************************************************************** Loads the employee time data from the file empTime is a vector of EmployeeTime struct fileName is the name of the file to read the data from ****************************************************************/ void loadEmployeeTime(vector
/*************************************************************** Creates a payroll report and writes it out to a file employees is a vector of pointers to Employee class empTime is a vector of EmployeeTime struct fileName is the name of the file to write the data to ****************************************************************/ void createPayrollReport(const vector
/*************************************************************** findEmployee searchs for id in vector employees if id is found it returns an iterator to the employee in the vector if id is not found it returns an iterator pointing to end ****************************************************************/ vector
employee.dat file
H376575 Joan Churchill 3@H035616 Boris Lewis *@H116743 Stewart Ellison A@S745812 Joan McGrath @H829512 Emily Hamilton B@H106109 Brandon Hart ,@S136718 Maria Hernandez @H330422 Lucas Mills 2@H049829 Adrian Sanderson 4@H139208 Caroline Randall 1@S180820 Oliver Underwood `@H412233 Joseph Hughes C@S199506 Paul Johnston 0@H329991 Tracey Wilkins 4@H618851 Grace Buckland B@S580925 Nicholas Campbell @@H446014 William Fisher 0@H495505 Rachel Carr 4@S762003 Leah Paterson @H057526 Mary Glover &@
emp_time.dat file
035616 B@049829
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
