Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Payroll System Using Inheritance and Polymorphism You need to implement the following harder file and classes. 1. Define the following constants in a header file

Payroll System Using Inheritance and Polymorphism You need to implement the following harder file and classes.

1. Define the following constants in a header file called Employee.h

  • FACULTY_MONTHLY_SALARY = 5000.00
  • STAFF_MONTHLY_HOURS_WORKED = 160

2. Implement an abstract class Employee with the following requirements:

  • Attributes
    • last name (String)
    • first name (String)
    • ID number (String)
  • Default argument constructor and argument constructors.
  • Public methods
    • putData that displays the following information: ID Employee number :_________ Employee name: __________
    • 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: __________ Full Time Monthly Salary: _________

4. Implement a class Education with the following requirements:

  • Attributes
    • Degree (MS or PhD ) String type
    • Major (Engineering, Chemistry, English, etc ... ) String type
    • 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 (use enum statement) "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: __________ 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: __________ Hours works per month: ______ Monthly Salary: _________

Implement a test driver program that creates an array or a vector of class Employees 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 employees.

Use the following data to create Employee objects in your program.

Staff

  • Last name: Allen First name: Paita ID: 123 Hourly rate: $50.00
  • Last name: Zapata First Name: Steven ID: 456 Hourly rate: $35.00
  • Last name:Rios First name:Enrique ID: 789 Hourly rate: $40.00

Faculty

  • Last name: Johnson First name: Anne ID: 243 Level: Full Degree: Ph.D Major: Engineering Reseach: 3
  • Last name: Bouris First name: William ID: 791 Level: Associate Degree: Ph.D Major: English Reseach: 1
  • Last name: Andrade First name: Christopher ID: 623 Level: Assistant Degree: MS Major: Physical Education Research: 0

Part-time

  • Last name: Guzman First name: Augusto ID: 455 Hourly rate: $35.00 Hours worked per week: 30
  • Last name: Depirro First name: Martin ID: 678 Hourly rate: $30.00 Hours worked per week:15
  • Last name: Aldaco First name: Marque ID: 945 Hours worked per week: 35

Runtime output

ID Employee number: 123 Employee name: Paita Allen Full Time Monthly Salary: 8000

ID Employee number: 456 Employee name: Steven Zapata Full Time Monthly Salary: 5600

ID Employee number: 789 Employee name: Enrique Rios Full Time Monthly Salary: 6400

ID Employee number: 243 Employee name: Anne Johnson Full Professor Monthly Salary: 7000

ID Employee number: 791 Employee name: William Bouris Associate Professor Monthly Salary: 6000

ID Employee number: 623 Employee name: Christopher Andrade Assistant Professor Monthly Salary: 5000

ID Employee number: 455 Employee name: Augusto Guzman Hours work per month: 120 Monthly Salary: 4200

ID Employee number: 678 Employee name: Martin Depirro Hours work per month: 60 Monthly Salary: 1800

ID Employee number: 945 Employee name: Marque Aldaco Hours work per month: 140 Monthly Salary: 2800

Total monthly salary for all employees: $46800

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bookkeeping And Accounting

Authors: Greg Shields

1st Edition

1983673536, 978-1983673535

More Books

Students also viewed these Accounting questions