here is the code that I have. I'm supposed to be able to input 3 employees, display their individual totals and also combined totals. I know there's some error with the functions or adding, because my result is:
Employee Name ......................... mary
Base Pay .............................. 200
Hours in Overtime ..................... 3
Overtime Pay Amount ................... 22.5
Total Pay ............................. 222.5

%%%%%%%%%%%%%%%% EMPLOYEE SUMMARY DATA %%%%%%%%%%%%%%%%
%%%% Total Employee Salaries ........ = -9.25596e+061
%%%% Total Employee Hours ........... = -9.25596e+061
%%%% Total Overtime Hours ........... = -9.25596e+061
Employee Name ......................... jack
Base Pay .............................. 280
Hours in Overtime ..................... 6
Overtime Pay Amount ................... 63
Total Pay ............................. 343

%%%%%%%%%%%%%%%% EMPLOYEE SUMMARY DATA %%%%%%%%%%%%%%%%
%%%% Total Employee Salaries ........ = -9.25596e+061
%%%% Total Employee Hours ........... = -9.25596e+061
%%%% Total Overtime Hours ........... = -9.25596e+061
Employee Name ......................... ken
Base Pay .............................. 320
Hours in Overtime ..................... 8
Overtime Pay Amount ................... 96
Total Pay ............................. 416

%%%%%%%%%%%%%%%% EMPLOYEE SUMMARY DATA %%%%%%%%%%%%%%%%
%%%% Total Employee Salaries ........ = -9.25596e+061
%%%% Total Employee Hours ........... = -9.25596e+061
%%%% Total Overtime Hours ........... = -9.25596e+061
Press any key to continue .

Please tell me where I need to adjust. I have tried adding and changing things and then I receive compiler errors. With the current code I receive no errors, just not the desired outcome either.

#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 DisplayTotals(void);
void Addsomethingup (EmployeeClass, EmployeeClass, EmployeeClass);
string EmployeeName ;
double hours ;
double wage ;
double basepay ;
double overtime_hours ;
double overtime_pay ;
double overtime_extra ;
double iTotal_salaries ;
double iIndividualSalary ;
double iTotal_hours ;
double iTotal_OvertimeHours ;
	 
};
	int main()
{   system("cls");
	cout << "\nWelcome to the Employee Pay Center\n\n" ;
	 
EmployeeClass Emp1;
EmployeeClass Emp2;
EmployeeClass Emp3;
	 
	cout << "Enter the first employee's name      = ";
	cin >> Emp1.EmployeeName;
system("cls");
	cout << "\nEnter the hours worked               = ";
	cin >> Emp1.hours;
system("cls");
	cout << "\nEnter his or her hourly wage         = ";
	cin >> Emp1.wage;
system("cls");
	 
	cout << "Enter the next employee's name      = ";
	cin >> Emp2.EmployeeName;
system("cls");
	cout << "\nEnter the hours worked               = ";
	cin >> Emp2.hours;
system("cls");
	cout << "\nEnter his or her hourly wage         = ";
	cin >> Emp2.wage;
system("cls");
	 
	cout << "Enter the next employee's name      = ";
	cin >> Emp3.EmployeeName;
system("cls");
	cout << "\nEnter the hours worked               = ";
	cin >> Emp3.hours;
system("cls");
	cout << "\nEnter his or her hourly wage         = ";
	cin >> Emp3.wage;
system("cls");
	 
	cout << endl;
Emp1.ImplementCalculations(Emp1.EmployeeName, Emp1.hours, Emp1.wage);
Emp2.ImplementCalculations(Emp2.EmployeeName, Emp2.hours, Emp2.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)]
	*/
system ("pause");
return  0;
} //End of Main Function
	 
void EmployeeClass::ImplementCalculations (string EmployeeName, int hours, double wage){
//*Initialize overtime variables*//
overtime_hours=0;
overtime_pay=0;
overtime_extra=0;
	    if (hours > 40)
{     
	 
basepay = 40 * wage;
overtime_hours = hours - 40;
overtime_pay = wage * 1.5;
overtime_extra = overtime_hours * overtime_pay;
iIndividualSalary = overtime_extra + basepay;
 
}   // if (hours > 40)
	  else
{ 
basepay = hours * wage;
iIndividualSalary = basepay;    
 
} // End of the else
DisplayEmployInformation();

void addsomethingup ();

DisplayTotals();
          
} //End of Primary Function
      
void EmployeeClass::DisplayEmployInformation () {
	    // This function displays all the employee output information.
	cout << "Employee Name ......................... " << setw(15) << EmployeeName <<endl;
	cout << "Base Pay .............................. " << setw(15) << basepay << endl;
	cout << "Hours in Overtime ..................... " << setw(15) << overtime_hours << endl;
	cout << "Overtime Pay Amount ................... " << setw(15) << overtime_extra << endl;
	cout << "Total Pay ............................. " << setw(15) << iIndividualSalary << endl << endl;
} // END OF Display Employee Information
      
void EmployeeClass::Addsomethingup (EmployeeClass Emp1, EmployeeClass  Emp2, EmployeeClass Emp3){
// Adds two objects of class Employee passed as
// function arguments and saves them as the calling object's data member values.
	iTotal_salaries = Emp1.iIndividualSalary + Emp2.iIndividualSalary + Emp3.iIndividualSalary;
	iTotal_hours = Emp1.hours + Emp2.hours + Emp3.hours;
	iTotal_OvertimeHours = Emp1.overtime_hours + Emp2.overtime_hours + Emp3.overtime_hours;
}
void EmployeeClass::DisplayTotals () {
cout << "%%%%%%%%%%%%%%%% EMPLOYEE SUMMARY DATA %%%%%%%%%%%%%%%%" << endl;
	cout << "%%%% Total Employee Salaries ........ = " << iTotal_salaries << endl;
	cout << "%%%% Total Employee Hours ........... = " << iTotal_hours << endl;
	cout << "%%%% Total Overtime Hours ........... = " << iTotal_OvertimeHours << endl;



	} // End of function

My guess is that you don't initialize thouse doubles. Or divide by something incredibly close to zero.
I can't see the DisplayTotals() method called in main, so it's hard to say what's actually wrong.

Also, it's an old story, but since those are fixed point numbers, store them as integers (store the amount of cents, not dollars), not doubles, for the sake of accuracy.

Other than that, why did you write the ImplementCalculations() like this? If you always use the values for the current employee, just use the class members, without passing them as method arguments.

And the totals could be stored as static and updated upon each change - would make your life easier.

For the Addsomethingup() method, wouldn't operator+() or operator+=() be better? Then just put them in a vector and go over it summing up everything. In general, it would be better to us a vector (or an array if you have to) for a set of similar objects instead of just making n variables (the only time I've ever seen things like var35 was in a generated code for a shader).

One last thing: please use proper indentation, that would make reading your code easier.

I added the DisplayTotals (); at line 108. I need to move it into the main program then? and the iTotals that I'm wanting summed up should be int instead of double?
I aws researching functions functions and it showed that the proper way to call my ImplementCalculations function was to list it as ImplementCalculations ();but you are saying that I should list the members instead as the display? I'm sorry, i get confused when it comes to working with classes. and sorry about the indention, working on that. thank you so much!

What I meant about ImplementCalculations() is that it's declaration can be

void ImplementCalculations();

since you always call it using class members instead. The code can stay the same since the names are the same.

What is that in line 106? Why do you declare a function there?

The thins with ints instead of doubles is, if you have a number like money - which you KNOW will always be rounded to 1/100th, then just multiply all values by 100, and store those as ints - that's the better way to do it. Although you do have to watch out around multiplication and division.

Please allow me to direct you to the cplusplus.com tutorial - it explains classes in a good way, I hope that will help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.