0

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
Calculate();
Employee::Calculate;

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 by usdblades: typo

5
Contributors
6
Replies
7
Views
4 Years
Discussion Span
Last Post by NathanOliver
0
Employee::Calculate(totalOvertimeHours, totalSalary, totalHours);
Employee::Calculate(Employee employee1, Employee employee2, Employee employee3);
Employee::Calculate(totalOvertimeHours);
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 by usdblades

0

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.

-1

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);
0

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

Edited by NathanOliver

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.