Computer Science
COSC1408 Foundations of Computer Science II
Term Project Phase I
Due Date: Monday, 04/27/2020
Design a class named Employee. The class should keep the following information:
name (s string)
id number (a string)
default constructor
a constructor with 2 parameters for the 2 attributes
get and set methods for the two attributes
double earnings(): an abstract method, returns employee's earnings
void print():an abstract method, print employee's information
Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information:
shift (an integer)
hours (an integer)
hourly pay rate (a double)
default constructor
constructor with parameters for all attributes
get and set methods
double earnings(): inherited and redefined earnings() in Employee, returns a
ProductionWorker's earnings. earnings = hourly pay rate * hours
void print():inherited and redefined print() in Employee, prints ProductionWorker information
The workday is divided into two shifts: day and night. The shift variable will hold an integer
value representing the shift that the employee works. The day shift is shift 1, and the night shift
is shift 2. The salary is calculated as hourly pay rate * hours per week.
Write a class named ShiftSupervisor. A shift supervisor is a salaried employee who supervises a shift. In addition to a salary, the shift supervisor earns a monthly bonus when his or her shift
meets production goals. Design a ShiftSupervisor class that is derived from the Employee class. The salary is calculated by salary plus the bonus. The ShiftSupervisor class should have the following information:
bonus (a double)
salary (a double)
default constructor
constructor with parameters for all attributes
get and set methods
double earnings():inherited and redefined earnings() in Employee, returns a
ShiftSupervisor's earnings. earnings = salary + bonus
void print():inherited and redefined print() in Employee, prints ShiftSupervisor information
Use Phase1.cpp to test your program.
Output:
Bob's salary = $1500
Alice's salary = $45000
Name: John
ID: 12345
Shift: 1
Hours: 40
Hourly pay rate: 30
Salary: 1200
Name: Joe
ID: 22222
Base salary: $40000
Bonus: $5000
Salary: $45000
Name: Jane
ID: 33333
Shift: 2
Hours: 35
Hourly pay rate: 50
Salary: 1750