Here is a snippet of my code as this is my final and would hate for anyone to find this and copy my final that I am working hard on. Everything else is working and is good. My problem is trying to get the following code to display.

void Employee::Calculate (Employee employee1, Employee employee2, Employee employee3)
    totalSalary = employee1.ePay + employee2.ePay + employee3.ePay;
    totalHours = employee1.eHours +  employee2.eHours + employee3.eHours;
    totalOvertimeHours = employee1.eOvertimeHours + employee2.eOvertimeHours + employee3.eOvertimeHours;

    cout << "*************************************************\n";
    cout << "**************EMPLOYEE SUMMARY DATA**************\n";
    cout << "*************************************************\n";
    cout << "**Total Employee Salaries .............." << totalSalary << "**\n";
    cout << "**Total Employee Hours .................." << totalHours << "**\n";
    cout << "**Total Overtime Hours  ................." << totalOvertimeHours << "**\n\n";

I have tried

I have looked at other examples that I could find and every code looks way different. How would I go about printing this part out?

Edited 4 Years Ago by usdblades: typo

Employee::Calculate(totalOvertimeHours, totalSalary, totalHours);
Employee::Calculate(Employee employee1, Employee employee2, Employee employee3);
Employee::Calculate(Employee employee1);

When trying any of these, I get errors. (I am typing these in my main function)

Would posting all my code help?

Edited 4 Years Ago by usdblades

Posting your errors will do more.

Also, using the same parameter types that you defined in the method would do wonders to reducing errors. Look up how to define parameters vs making the call. You're close, but making a silly mistake.

try to use inline.. like this:

Inline Employee::Calculate(totalOvertimeHours, totalSalary, totalHours);
Inline Employee::Calculate(Employee employee1, Employee employee2, Employee employee3);
Inline Employee::Calculate(totalOvertimeHours);
Inline Employee::Calculate(Employee employee1);

@ usdblades - When you use a function do you include the data type of the pramater when you pass the variable?

Edited 4 Years Ago by NathanOliver

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