kaosuvls 0 Newbie Poster

Ok Guys this is what I have to do:


o Provide six test plans to verify the logic within the program.
o Plan 1 must display the proper information for employee #1 with overtime pay.
o Plan 2 must display the proper information for employee #1 with no overtime pay.
o Plans 3-6 are duplicates of plan 1 and 2 but for the other employees.


I do not know how to get this started. Just an example in code will get me there guys.

This is my code I have to test.

#include <iostream>
    #include <string>
    #include <iomanip>
       
    using namespace std;

    struct EmployeeClass
    {
        void ImplementCalculations(int hours, float wage);
        void DisplayEmployInformation(void);
        string employeeFirstName, employeeLastName;
        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 ;
    };

    void Addsomethingup(EmployeeClass theEmployees[], int totalEmployees);

    const int NumEmployees = 3;


    int main()
    {
       system("cls");
       
       cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
        cout << "\nWelcome to Data Max Inc. Employee Pay Center\n\n" ;
       cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
       


        EmployeeClass Emp[NumEmployees];  // array
        for (int i = 0; i < NumEmployees; ++i ){

        cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
            cout << "\n\nEnter Employee # " <<  i+1 << " first name = ";
            cin >> Emp[i].employeeFirstName;

            cout << "\n\nEnter Employee # " <<  i+1 << " last name = ";
            cin >> Emp[i].employeeLastName;
       
            cout << "\n\nEnter the hours worked = ";
            cin >> Emp[i].hours;
       
            cout << "\n\nEnter employee's hourly wage = " ;
            cin >> Emp[i].wage;
        }

        for (int i = 0; i < NumEmployees; ++i )
            Emp[i].ImplementCalculations(Emp[i].hours, Emp[i].wage);
       
    Addsomethingup( Emp, NumEmployees);

    cin.get();
       cin.get();
          return 0;
    }

    void EmployeeClass::ImplementCalculations(int hours, float wage)
    {
         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;

       cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
            DisplayEmployInformation ();
          }
        
         else
         { 
       basepay = hours * wage;
            iIndividualSalary = basepay;

       cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
            DisplayEmployInformation ();
         }
        
        
    }

    void EmployeeClass::DisplayEmployInformation () {
       // This function displays all the employee output information.
       
    cout.setf(ios::fixed);
    cout.precision(2);
       
        cout << "\n\n";
        cout << "Employee First Name ............. = " << employeeFirstName << endl;
       cout << "Employee Last Name .............. = " << employeeLastName << endl;
        cout << "Base Pay ........................ = " << basepay << endl;
        cout << "Hours in Overtime ............... = " << overtime_hours << endl;
        cout << "Overtime Pay Amout............... = " << overtime_extra << endl;
        cout << "Total Pay ....................... = " << iIndividualSalary << endl;
       
    } // END OF Display Employee Information


    void Addsomethingup(EmployeeClass theEmployee[], int totalEmployees)
    {

       float iTotal_salaries = 0;;
            int iTotal_hours = 0;
            int iTotal_OvertimeHours = 0;

       for (int i = 0; i < totalEmployees; ++i )
            {
                 iTotal_hours += theEmployee[i].hours;
                 iTotal_salaries += theEmployee[i].iIndividualSalary;
                 iTotal_OvertimeHours += theEmployee[i].overtime_hours;
            }
       
        cout << "\n\n" << endl;
        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;
        cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;

    } // End of function

    class Tester
    {
    public:
        void test1(EmployeeClass theEmployee[], int totalEmployees)
        {
        string employee;
       
        }
          
    };

I started making a Tester class but do not know if this is right or not.

Thanks for any input guys....