#include <iostream>
using namespace std;



//class definition
class Wage
{
public:

    int duration;
    int price;

    int calculateWage()
    {
        cout<<
        "To exit program enter -1, to continue enter 1! ";
        cin>> duration;

        while(duration != -1)
        {
            cout<<
            "\n\nEnter employee hours worked (or -1 to quit): ";
            cin>> duration;

            {
            if(duration <= 40 )
                {
                cout<<
                "\nEmployee regular working hours is: "<< duration << "hr.\n";
                cout<<
                "Employee Overtime hour(s) is: 0hr\n";
                cout<<
                "Employee net salary is: $" << duration*price << "\n\n\n";
                }
            else
                {
                cout<<
                "\nEmployee regular working hours is: 40hr.\n";
                cout<<
                "Employee Overtime hour(s) is: " <<duration-40 <<"hr.\n";
                cout<<
                "Employee net salary is: $" << ((40*price)+((duration-40)*(1.5*price))) <<"\n\n\n";

                }
            }

        }

    }


};

//executing actual program using function main

int main()
{

    Wage payRoll;
    payRoll.calculateWage();

return 0;
}

You posted your program but failed to ask a question. We aren't mind readers.

please help me make my program run.

The price variable should be initialized to some value in your calculateWage function. Otherwise, your net salary calculations are meaningless.

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.