#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;
}
guerratg 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
guerratg 0 Newbie Poster
BobS0327 24 Junior Poster in Training
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.