I am having a trouble calling my addsomethingup() function in my program. I keep getting the error too few arguments. Can anyone help me understand why this is not working please?

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
using std::cout;

//
//CLASS DECLARATION SECTION
//
class EmployeeClass {
public:
        void ImplementCalculations(string EmployeeName, int hours, float wage);
        void DisplayEmployInformation();
        void Addsomethingup(EmployeeClass, EmployeeClass, EmployeeClass);
        string EmployeeName;
        int hours;
        float wage;
        float basepay;
        int overtime_hours;
        float overtime_pay;
        float overtime_extra;
        float iTotal_salaries;
        float iIndividualSalary;
        int iTotal_hours;
        int iTotal_OvertimeHours;
};
    EmployeeClass Employ1;
    EmployeeClass Employ2;
    EmployeeClass Employ3;


int main()
{
    system("cls");

    // display welcome information
    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.
    */



    /*
    Here you will prompt for the first employee’s information.
    Prompt the employee name, hours worked, and the hourly wage.  For each piece of information, you will update the appropriate class member defined above.
    Example of Prompts
    Enter the employee name      =
    Enter the hours worked       =
    Enter his or her hourly wage =
    */
    // Enter employees information
    cout << "Enter the first employee's name      = ";
    cin >> Employ1.EmployeeName;
    cout << "\nEnter the hours worked               = ";
    cin >> Employ1.hours;
    cout << "\nEnter his or her hourly wage         = ";
    cin >> Employ1.wage;


    /*
    Here you will prompt for the second employee’s information.
    Prompt the employee name, hours worked, and the hourly wage.  For each piece of information, you will update the appropriate class member defined above.
    Enter the employee name      =
    Enter the hours worked       =
    Enter his or her hourly wage =
    */
    cout << "\nEnter the second employee's name      = ";
    cin >> Employ2.EmployeeName;
    cout << "\nEnter the hours worked                = ";
    cin >> Employ2.hours;
    cout << "\nEnter his or her hourly wage          = ";
    cin >> Employ2.wage;


    /*
    Here you will prompt for the third employee’s information.
    Prompt the employee name, hours worked, and the hourly wage.  For each piece of information, you will update the appropriate class member defined above.
    Enter the employee name      =
    Enter the hours worked       =
    Enter his or her hourly wage =
    */
    cout << "\nEnter the third employee's name      = ";
    cin >> Employ3.EmployeeName;
    cout << "\nEnter the hours worked               = ";
    cin >> Employ3.hours;
    cout << "\nEnter his or her hourly wage         = ";
    cin >> Employ3.wage;


    /*
    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)] ;
    */

    cout << endl;
    Employ1.ImplementCalculations(Employ1.EmployeeName, Employ1.hours, Employ1.wage);
    Employ2.ImplementCalculations(Employ2.EmployeeName, Employ2.hours, Employ2.wage);
    Employ3.ImplementCalculations(Employ3.EmployeeName, Employ3.hours, Employ3.wage);




} // return 0;





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

    //Initialize overtime variables
    overtime_hours = 0;
    overtime_pay = 0.0;
    overtime_extra = 0.0;


    if (hours > 40)// calculate overtime if hours greater than 40
    {

        basepay = (40 * wage);
        overtime_hours = hours - 40;
        overtime_pay = wage * 1.5;
        overtime_extra = overtime_hours * overtime_pay;
        iIndividualSalary = (overtime_extra + basepay);

        DisplayEmployInformation();
    }
    // if (hours > 40)
    else
    {

        basepay = hours * wage;
        iIndividualSalary = overtime_pay + 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 Pay .............................. " << basepay << endl;
    cout << "Hours in Overtime ..................... " << overtime_hours << endl;
    cout << "Overtime Pay Amount ................... " << overtime_hours * overtime_pay << endl;
    cout << "Total Pay ............................. " << iIndividualSalary << endl;


        Addsomethingup(Employ1,Employ2,Employ3);

}// END OF Display Employee Information



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.
        */
        iTotal_hours = Employ1.hours + Employ2.hours + Employ3.hours;
        iTotal_salaries = Employ1.iIndividualSalary + Employ2.iIndividualSalary + Employ3.iIndividualSalary;
        iTotal_OvertimeHours = Employ1.overtime_hours + Employ2.overtime_hours + Employ3.overtime_hours;
        /*
        Then display the information below.
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%% EMPLOYEE SUMMARY DATA%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%% Total Employee Salaries ..... = 576.43
        %%%% Total Employee Hours ........ = 108
        %%%% Total Overtime Hours......... = 5
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        */





        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 Overtime Hours ........... = " << iTotal_OvertimeHours << endl;
        cout << endl;

        // End of function

    };

You are right. I am sorry.. The problem I am having now is the output. The code prints a summary after each employee's information. I need it to only print it once and at the end.. How can I fix this? I am using VS as my IDE.

At a glance I'd say take these calls DisplayEmployInformation(); out of ImplementCalculations method and call it after.

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