1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
#include <iostream>
#include <string>
#include <iomanip>
#pragma once
using namespace std;
//
//CLASS DECLARATION SECTION
//
class EmployeeClass {
public:
void ImplementCalculations(string EmployeeName, int hours, double wage);
void DisplayEmployInformation(string EmployeeName, double basepay, int overtime_hours, double overtime_pay, double iIndividualSalary);
void Addsomethingup(EmployeeClass Employ1, EmployeeClass Employ2, EmployeeClass Employ3);
string EmployeeName;
int hours;
double wage;
double basepay;
int overtime_hours;
double overtime_pay;
double overtime_extra;
double iTotal_salaries;
double iIndividualSalary;
int iTotal_hours;
int iTotal_OvertimeHours;
EmployeeClass(string name, int employee_hours, double employee_base_wage): EmployeeName(name), hours(employee_hours), wage(employee_base_wage){}
};
int main()
{ system("cls");
cout << "\nWelcome to the Employee Pay Center\n\n" ;
/*
Use this section to define your objects. You will have one object per employee. You have only three employees.
The format is your class name and your object name.
*/
string emp_name;
int emp_hours;
double emp_wage;
emp_hours = 0;
emp_wage = 0.0;
EmployeeClass emp1(emp_name, emp_hours, emp_wage);
EmployeeClass emp2(emp_name, emp_hours, emp_wage);
EmployeeClass emp3(emp_name, emp_hours, emp_wage);
/*first employee enter*/
cout << "Enter the first employee's name = " << endl;
cin >> emp1.EmployeeName;
cout << "Enter the hours worked = " << endl;
cin >> emp1.hours;
cout << "Enter his or her hourly wage = " << endl;
cin >> emp1.wage;
cout << endl;
/*second employee enter*/
cout << "Enter the second employee's name = " << endl;
cin >> emp2.EmployeeName;
cout << "Enter the hours worked = " << endl;
cin >> emp2.hours;
cout << "Enter his or her hourly wage = " << endl;
cin >> emp2.wage;
cout << endl;
/*third employee enter*/
cout << "Enter the third employee's name = " << endl;
cin >> emp3.EmployeeName;
cout << "Enter the hours worked = " << endl;
cin >> emp3.hours;
cout << "Enter his or her hourly wage = " << endl;
cin >> emp3.wage;
cout << endl;
/*
Here you will implement a function call to implement the employ calcuations for each object defined above. You will do this for each of the three employees or objects.
The format for this step is the following:
[(object name.function name(objectname.name, objectname.hours, objectname.wage)] ;
*/
emp1.ImplementCalculations(emp1.EmployeeName, emp1.hours, emp2.wage);
emp2.ImplementCalculations(emp2.EmployeeName, emp2.hours, emp3.wage);
emp3.ImplementCalculations(emp3.EmployeeName, emp3.hours, emp3.wage);
/*
This section you will send all three objects to a function that will add up the the following information:
- Total Employee Salaries
- Total Employee Hours
- Total Overtime Hours
The format for this function is the following:
- Define a new object.
- Implement function call [objectname.functionname(object name 1, object name 2, object name 3)]
*/
double total_salaries = emp1.iIndividualSalary + emp2.iIndividualSalary + emp3.iIndividualSalary;
int total_hours = emp1.hours + emp2.hours + emp3.hours;
double total_overtime = emp1.overtime_hours + emp2.overtime_hours + emp3.overtime_hours;
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl
<< "%%%% EMPLOYEE SUMMARY DATA%%%%%%%%%%%%%%%%%%%%%%%" << endl
<< "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl
<< "%%%% Total Employee Salaries ..... = " << total_salaries << endl
<< "%%%% Total Employee Hours ........ = " << total_hours << endl
<< "%%%% Total Overtime Hours......... = " << total_overtime << endl
<< "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl
<< "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
system("pause");
} //End of Main Function
void EmployeeClass::Addsomethingup(EmployeeClass Employ1, EmployeeClass Employ2, EmployeeClass Employ3){
// Adds three objects of class Employee passed as
// function arguments and saves them as the calling object's data member values.
/*
Add the total hours for objects 1, 2, and 3.
Add the salaries for each object.
Add the total overtime hours.
*/
/*
Then display the information below.
*/
} // End of function
|