#include #include #include #include #define MAXEMP 2 //Layout the class Employee //---------------------------------------------------------------------------// class Employee { char name[21]; //char string for the employee name float hours; //float number for the hours worked float wage; //float number for the hourly wage public: void display_data(void); void setname(char*); void sethours(float); void setwage(float); }; //---------------------------------------------------------------------------// // define member functions void Employee::setname(char* tname) { strcpy(name,tname); return; } void Employee::sethours(float thours) { hours=thours; return; } void Employee::setwage(float twage) { wage=twage; return; } void Employee::display_data() { cout << name << setw(20) << wage << setw(10) << hours << endl; } //-------------------------begin MAIN function-------------------------------// int main() { Employee wages[MAXEMP]; // create an array where each element // is an instance of the class Employee char nl; // temporary var to flush newline character char tempname[21]; // temporary var to hold employee name float tempwage; // " " " wage float temphours; // " " " hours fstream infile; infile.open("employee.dat", ios::in); // open the file for input int e; for(e=0;e> tempwage; infile.get(nl); wages[e].setwage(tempwage); infile >> temphours; infile.get(nl); wages[e].sethours(temphours); } infile.close(); // display column headings on screen cout << "EMPLOYEE NAME" << setw(25) << "PAY/HR" << setw(10) << "HOURS" << endl; // display employee data on screen in columns for(e=0;e