Explore BrainMass
Share

# Creating Classes and Inheretence usage

Create an Employee class for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees that work over 40 hours will receive overtime pay of one and a half of their hourly rate for overtime hours worked. The output should display the name of each employee, hours worked, hourly rate, overtime pay, regular (gross) pay, tax amount, and net pay. The average net pay of all employees should also be displayed.

Have the Employee Payroll program include hourly based and salary based employees. This phase uses an array of employee objects, inheritance for different classes of employees, and polymorphism for salary computation. The 52 week yearly salary as well as number of overtime hours worked by a salary based employee is given). For salary based employees, to find the regular (gross) pay for a week, divide the salary by 52. To compute the overtime pay for a salary based employee, first find the hourly rate by dividing the gross pay by 40, and then compute overtime pay. For every employee, overtime pay, tax amount, and net pay must also be computed. In addition, the program should find the minimum and maximum net pay of all employees as well as sort the employees based on their net pay (ascending order).

Expand the payroll program to combine two sorting techniques (Selection and Exchange sorts) for better efficiency in sorting the employee's net pay.

Ok, so what i have so far for the class is:

#include <iostream >
#include <fstream >

using namespace std;

class Employee {
public:
Employee(string name, double rate, double gross, double net, int hours); //Name, Pay Rate, Gross Pay, Net Pay, Hours worked

string getName();
double getrate();
double getgross();
double getnet();
int gethours();

private:
string name;
double rate;
int hours;
double gross;
double Net;
};

Employee::Employee(string name, double rate, double gross, double net, int hours){

}
string Employee::getName()
{
return name;
}
double Employee::getrate()
{
return rate;
}
double Employee::gethours()
{
return hours;
}
double Employee::getgross()
{
return ((rate * (hours - 40)) + ((hours - 40) * 1.5))
};

double Employee::getnet()
{
return (((rate * (hours - 40)) + ((hours - 40) * 1.5)) * .3)
};

void main(){

}

But i have no idea if the class portion is correct, much less how to incorporate it into an array (Employee[]?)

Help would be verily appreciated.

© BrainMass Inc. brainmass.com August 20, 2018, 9:51 pm ad1c9bdddf

#### Solution Summary

The solution creates classes and inheritance usages.

\$2.19