This is a c++ program Please write this program in C++ Payroll System Using Inhe
ID: 3764483 • Letter: T
Question
This is a c++ program
Please write this program in C++
Payroll System Using Inheritance and Polymorphism
Define the following constants in a header file.
FACULTY_MONTHLY_SALARY = 5000.00
STAFF_MONTHLY_HOURS_WORKED = 160
Implement an abstract class Employee with the following requirements:
Attributes
last name (String)
first name (String)
ID number (String)
Sex - M or F
Birth date (Date)
Default argument constructor and argument constructors.
Public methods
putData that displays the following information:
ID Employee number :_________
Employee name: __________
Birth date: _______
get and set methods
pure virtual method monthlyEarning that returns the monthly earning.
3. Implement a class called Staff extending from the class Employee with the following requirements:
Attribute
Hourly rate
Default argument and argument contructors
Public methods
get and set
The method monthlyEarning returns monthly salary (hourly rate times 160)
putData that displays the following information:
ID Employee number :_________
Employee name: __________
Birth date: _______
Full Time
Monthly Salary: _________
Implelment a class Education with the following requirements:
Attributes
Degree (MS or PhD )
Major (Engineering, Chemistry, English, etc ... )
Research (number of researches)
Default argument and argument constructors.
Public methods
get and set
Implement a class Faculty extending from the class Employee with the following requirements:
Attributes
Level
"AS": assistant professor
"AO": associate professor
"FU": professor
Education object
Default argument and argument constructor
Public methods
get and set
The method monthlyEarning returns monthly salary based on the faculty's level.
AS - faculty monthly salary
AO - 1.2 times faculty monthly salary
FU - 1.4 times faculty monthly salary
putData that displays the following information:
ID Employee number :_________
Employee name: __________
Birth date: _______
XXXXX Professor where XXXXX can be Assistant, Associate or Full
Monthly Salary: _________
Implement a class called Partime extending from the class Staff with the following requirements:
Attributes
Hours worked per week
Default argument and argument constructors
Public methods
set and get
The method monthlyEarning returns monthly salary which hourly rate multiplied hours worked per week multiplied four.
putData that displays the following information:
ID Employee number :_________
Employee name: __________
Birth date: _______
Hours works per month: ______
Monthly Salary: _________
Implement a test driver program that creates a one-dimensional array of class Employee to store the objects Staff, Faculty and Partime.
Using polymorphism, display the following outputs:
a. Employee information using the method putData.
All employees
Staff
Faculty
Part-time
b. Total monthly salary for all the part-time staff .
c. Total monthly salary for all employees.
Please write this program in C++ not java.
Explanation / Answer
/*
//HEADER
FACULTY_MONTHLY_SALARY = 5000.00
STAFF_MONTHLY_HOURS_WORKED = 160
class Employee {
public:
char *lastName;
char *firstName;
char *IDNumber;
char sex; // M = male, F = Female
date birthDate;
public:
void putData() {
cout << " ID Employee Number: " << IDNumber;
cout << " Employee Name: " << firstName <, lastName;
cout << " Birth Date: " << birthDate;
} // end putData function
void get() {
}
void set() {
}
pure virtual monthlyEarnings() {
} // end func monthlyEarnings
}; // end of class Employee
class Staff extends Employee {
public:
float hourlyRate;
double monthlySalary;
void putData() {
cout << " ID Employee Number: " << IDNumber;
cout << " Employee Name: " << firstName <, lastName;
cout << " Birth Date: " << birthDate;
cout << " Full Time Monthly Salary: " << monthlySalary;
} // end putData function
} ; // end class Staff
*/
#include <iostream.h> // input output stream header file
#include <stdio.h> // standard input output header file
#include <stdlib.h> // standard library header file
//#include <string.h> // header file with string function
// #include <conio.h> // console input output header file
#include "pay1.h"
int main() // start main
{
return 0; // exit
} // end of main()
/*
//HEADER
FACULTY_MONTHLY_SALARY = 5000.00
STAFF_MONTHLY_HOURS_WORKED = 160
class Employee {
public:
char *lastName;
char *firstName;
char *IDNumber;
char sex; // M = male, F = Female
date birthDate;
public:
void putData() {
cout << " ID Employee Number: " << IDNumber;
cout << " Employee Name: " << firstName <, lastName;
cout << " Birth Date: " << birthDate;
} // end putData function
void get() {
}
void set() {
}
pure virtual monthlyEarnings() {
} // end func monthlyEarnings
}; // end of class Employee
class Staff extends Employee {
public:
float hourlyRate;
double monthlySalary;
void putData() {
cout << " ID Employee Number: " << IDNumber;
cout << " Employee Name: " << firstName <, lastName;
cout << " Birth Date: " << birthDate;
cout << " Full Time Monthly Salary: " << monthlySalary;
} // end putData function
} ; // end class Staff
class Education {
char *Degree;
char *major;
int researchers;
void get() {
}
void set() {
}
} ; // end class education
class Faculty extends Employee {
char *level;
Education objEdn;
void get() {
}
void set() {
}
void putData() {
cout << " ID Employee Number: " << IDNumber;
cout << " Employee Name: " << firstName <, lastName;
cout << " Birth Date: " << birthDate;
cout << " Full Time Monthly Salary: " << monthlySalary;
} // end putData function
};
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.