Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I ( 2 pts) Define the following constants in a header file. FACULTY_MONTHLY_SALARY = 5000.00 STAFF_MONTHLY_HOURS_WORKED = 160 Use the Date class you created in

I( 2 pts) Define the following constants in a header file.

FACULTY_MONTHLY_SALARY = 5000.00

STAFF_MONTHLY_HOURS_WORKED = 160

Use the Date class you created in previous activity.

( 2 pts) Implement an abstract class Employee with the following requirements:

Member variables:

last name (String)

first name (String)

ID number (String)

Sex - M or F

Birth date (Date)

Default and overloaded constructors.

Public methods

Virtual Print()to display the following information:

ID Employee number :_________

Employee name: __________

Birth date: _______

get and set methods

pure virtual double monthlyEarning().

Here is partial Employee class (you need to add all other member functions)

#include

#include

#include "Date.h"

using namespace std;

const int FACULTY_MONTHLY_SALARY = 5000.00;

const int STAFF_MONTHLY_HOURS_WORKED = 160;

class Employee

{

public:

Employee();

Employee(string, string, int, char, Date);

virtual void Print();

virtual double monthlyEarning()=0;//pure virtual function to indicate the class is //abstract. WE DONT IMPLEMENT THIS FUNCTION IN THIS CLASS, BUT ALL CLASSES THAT INHERIT //THIS CLASS MUST IMPLEMENT THIS FUCNTION.

string getLname();

string getFname();

int getId();

char getSex();

void setFname(string k) ;

//more functions here.

protected:

string l_name;

string f_name;

int ID;

char sex;

Date db;

};

Note: Employee class cant be initiated in main, i.e. cant write Employee e;

(9 pts) Implement a class called Staff that inherits from the class Employee with the following requirements:

Member variables

Hourly rate

Default and overloaded constructors.

Public methods

get and set

The method monthlyEarning() returns monthly salary (hourly rate times 160)

Print that displays the following information:

ID Employee number :_________

Employee name: __________

Birth date: _______

Full Time: ________ (print hourly rate here)

Monthly Salary: _________

(9 pts) Implement a class Education with the following requirements:

Variables:

Degree (MS or PhD )

Major (Engineering, Chemistry, English, etc ... )

Research (number of researches)

Default and overloaded constructors.

Public methods

get and set

(9 pts) Implement a class Faculty inheriting from the class Employee with the following requirements:

Variables

String Level "AS": assistant professor "AO": associate professor "FU": professor

Education object

Default and overloaded constructors

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

Print that displays the following information:

ID Employee number :_________

Employee name: __________

Birth date: _______

XXXXX Professor where XXXXX can be Assistant, Associate or Full

Monthly Salary: _________

(9 pts) Implement a class called Partime which inherits from the class Staff with the following requirements:

Variables

Hours worked per week

Default and overloaded constructors

Public methods

set and get

The method monthlyEarning returns monthly salary which hourly rate multiplied hours worked per week multiplied four.

Print() that displays the following information:.

ID Employee number :_________

Employee name: __________

Birth date: _______

Hours works per month: ______

Monthly Salary: _________

(20 pts) Implement a main() program that creates a vector pointers of class Employee to store the objects Staff, Faculty and Partime. a. (1 pts) Create a vector of pointers to Employee class.

b. (7 pts) Store in the vector all the sample test data below.

Using polymorphism, display the following outputs:

a. (5 pts) Employee information using the method Print().

Staff

Faculty

Part-time

b. (7 pts) Total monthly salary for all employees.

Sample Test Data

Staff

Last name: Allen First name: Paita ID: 123 Sex: M Birth date: 2/23/59 Hourly rate: $50.00

Last name: Zapata First Name: Steven ID: 456 Sex: F Birth date: 7/12/64 Hourly rate: $35.00

Last name: Rios First name: Enrique ID: 789 Sex: M Birth date: 6/2/70 Hourly rate: $40.00

Faculty

Last name: Johnson First name: Anne ID: 243 Sex: F Birth date: 4/27/62 Level: Full Degree: Ph.D Major: Engineering Research: 3

Last name: Bouris First name: William ID: 791 Sex: F Birth date: 3/14/75 Level: Associate Degree: Ph.D Major: English Research: 1

Last name: Andrade First name: Christopher ID: 623 Sex: F Birth date: 5/22/80 Level: Assistant Degree: MS Major: Physical Education Research: 0

Part-time

Last name: Guzman First name: Augusto ID: 455 Sex: F Birth date: 8/10/77 Hourly rate: $35.00 Hours worked per week: 30

Last name: Depirro First name: Martin ID: 678 Sex: F Birth date: 9/15/87 Hourly rate: $30.00 Hours worked per week:15

Last name: Aldaco First name: Marque ID: 945 Sex: M Birth date: 11/24/88 Hourly rate: $20.00 Hours worked per week: 35

Use this date class

Date.h

#pragma once

#include

using namespace std;

class Date

{

public:

Date();

Date(int, int, int);

int get_day();

int get_month();

int get_year();

void set_date(int, int, int);

void print();

private:

int day;

int month;

int year;

};

Date.cpp

#include "Date.h"

#include

using namespace std;

Date::Date() {

day = 0;

month = 0;

year = 0;

}

Date::Date(int day1, int month1, int year1) {

day = day1;

month = month1;

year = year1;

}

void Date::set_date(int day1, int month1, int year1) {

cout << "Enter date as Month,Day,Year";

cin >> month1 >> day1 >> year1;

month = month1;

day = day1;

year = year1;

}

int Date::get_day() {

return day;

}

int Date::get_month() {

return month;

}

int Date::get_year() {

return year;

}

void Date::print() {

cout << month << "/" << day << "/" << year;

}

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

Step: 3

blur-text-image

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

Students also viewed these Databases questions

Question

I need a answer 1 1 6 . viscosity Question in Chemical Engineering

Answered: 1 week ago