// Finals.cpp.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
//
//CLASS DECLARATION SECTION
//
class EmployeeClass {

public:
void ImplementCalculations(string EmployeeName, int hours, double wage);
void DisplayEmployInformation(void);
void Addsomethingup(void);
	

	string EmployeeName;

	int hours , overtime_hours, iTotal_hours, iTotal_OvertimeHours;

	double wage, basepay;
	double overtime_pay, overtime_extra;
	double iTotal_salaries, iIndividualSalary;
    
};

int main()
{


    cout << "\nDatamax, Inc - Welcome to the Employee <strong class="<<"highlight"<<">Pay</strong> Center\n\n";
  
//  I utilized an array and two loops.   

   EmployeeClass Employee[3]; 
   const int numEmployees = sizeof(Employee) / sizeof(Employee[0]);
   for (int i = 0; i < numEmployees; ++i )
   {
       cout << "\n\nEnter the employee name = ";
       cin >> Employee[i].EmployeeName;
       cout << "Enter the hours worked  = ";
       cin >> Employee[i].hours;
       cout << "Enter employee hourly wage = ";
       cin >> Employee[i].wage; 
    }

   for (int i = 0; i < numEmployees; ++i )
   {
       Employee[i].ImplementCalculations(Employee[i].EmployeeName, Employee[i].hours, Employee[i].wage);
   }
return 0; 
}

void EmployeeClass::ImplementCalculations (string EmployeeName, int hours, double wage){

  basepay = 0.0;
  overtime_hours = 0;
  overtime_pay = 0.0;
  overtime_extra = 0.0;
  iIndividualSalary = 0.0;
  


	  if (hours > 40)//More than 40 hours
	  {

	    basepay = (40 * wage);
        overtime_hours = hours - 40;
		overtime_pay = wage * 1.5;
		overtime_extra = overtime_hours * overtime_pay;
		iIndividualSalary = (overtime_extra + basepay);
		
       DisplayEmployInformation ();
	  }
	  else // less than 40 hours
	  {
	    basepay = hours * wage;
		iIndividualSalary = basepay; 


		DisplayEmployInformation ();
	 
	   } 

} //End of Primary Function

void EmployeeClass::DisplayEmployInformation() 
{
//This function displays all the employee output information.
     
        cout << "\n\n";
		cout << "Employee Name ............. = " << EmployeeName << endl;
		cout << "Base <strong class="<<"highlight"<<">Pay</strong> .................. = " << basepay << endl; 
		cout << "Hours in <strong class="<<"highlight"<<">Overtime</strong> ......... = " << overtime_hours << endl;
		cout << "<strong class="<<"highlight"<<">Overtime</strong> <strong class="<<"highlight"<<">Pay</strong> Amout......... = " << overtime_extra << endl;
        cout << "Total <strong class="<<"highlight"<<">Pay</strong> ................. = " << iIndividualSalary << endl;
         
	   Addsomethingup(); 

} // END OF Display Employee Information


   void EmployeeClass::Addsomethingup()
   { 

   iTotal_salaries = 0;
   iTotal_hours = 0;
   iTotal_OvertimeHours = 0;

	    
	  for (int i = 0; i < 1; ++i ) 
	  {

	    cout << "\n\n";
		cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
		cout << "%%%% EMPLOYEE SUMMARY DATA%%%%%%%%%%%%%%%%%%%%%%%" << endl; 
		cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
		cout << "%%%% Total Employee Salaries ..... =" << iTotal_salaries << endl;
        cout << "%%%% Total Employee Hours ........ =" << iTotal_hours << endl;
		cout << "%%%% Total <strong class="<<"highlight"<<">Overtime</strong> Hours......... =" << iTotal_OvertimeHours << endl;
		cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
		cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
	  }
   }

I need this to add up all three employees totals? Please help tell me what I am doing wrong??????

Comments
Why can't you give us a clue to what your program does and where it's not working?

Can you give us any more detail that might help?
Are you getting any compiler warnings/errors?
What output are you getting?
What output should you be getting?

This article has been dead for over six months. Start a new discussion instead.