The code

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

Class Employee
{     protected: string name;
                          double hoursworked;
                          double hourlyrate;
 
        public:
empyoyee(string n, double hw, double hr)
                     {
                       name = n;
                       hoursworked = hw;
                       hourlyrate = hr;
                     }

double computeOvertimePay()
                     {
                              if(hoursWorked > 40)
                              {     double overtimeHours;
                                                overtimeHours = hoursWorked - 40;
                                     return overtimeHours * hourlyRate * 1.5;
                              }
                                     else return 0;
                      }

double computeTaxAmount()
                    {
                                double taxRate = 0.3;
                                return computeGrossPay() * 0.3;
                    }

double computeNetPay()
                    {
                               return hourly() - computeTaxAmount();
                    }

string getName()
                    {
                              return name;
                    }

double getHoursWorked()
                   {
                              return hoursWorked;
                   }

double getHourlyRate()
                   {
                               return hourlyRate;
                   }
double bubblesort()
{
After the bubble sort of the array, the first element of the array would be the MIX and the last element would the MAX

}

double average()
{
     average =
total/counter;
}

};

class salary :  employee
{
    
grosspay = salary / 52
    
return grosspay()/40;
};

class hourly : employee
{
   
if (hoursworked > 40)
        return 40 * hourlyrate;
    else return hourlyrate * hourworked;
};


Void main()
  Employee *emp[100];
 
  int answer, hoursworked, salary, hourlyrate, count;
    string name; 

 

cout<<"Are you an Hourly or Salary. Enter 0 for hourly and 1 for salaryor 5 to quit"; 
cin>>answer;
 

//Input statement
while (answer!=5)

{
if (answer = 0)
{

    cout<<"
Please enter your name:";   
    cin>>name;
    cout<<"
Please enter your hours worked: ";
    cin>>hoursworked; 
    cout<<"Please enter your rate per hours:
";
   cin>>hourlyrate;
   emp1 = new hourly (name, hoursworked, hourlyrate);

}
else
{
   cout<<"
Please enter your name: ";
   cin>>name;
   cout<<"
Please enter your salary: ";
   cin>>salary;
  
emp2 = new salary (name, hoursworked, hourlyrate);
}
count++;
}

}

void output()
{
cout<<endl<<"Name of Employee is: "<<name<<endl;
cout<<"Hours Worked are : "<<hoursworked<<endl;
cout<<"Hourly Rate is : "<<hourlyrate<<endl;
cout<<"Over Time Pay is : "<<overtimepay()<<endl;
cout<<"Regular Pay is : "<<pay()<<endl;
cout<<"Tax Amount is : "<<tax()<<endl;
cout<<"Net Pay is : "<<netpay()<<endl<<endl;

}

 

Return Home Tutorial

 

Hosted by www.Geocities.ws

1