Computer Science

Paul Pog
Pahse1cpp.TXT

#include <iostream> #include <string> #include "ProductionWorker.h" #include "ShiftSupervisor.h" using namespace std; int main() { Employee *pw1 = new ProductionWorker("Bob", "11111", 30, 50, 1); Employee *ss1 = new ShiftSupervisor("Alice", "22222", 40000, 5000); cout << pw1->getName() << "\'s salary = $" << pw1->earnings() << endl; cout << ss1->getName() << "\'s salary = $" << ss1->earnings() << endl; cout << "\n\n"; Employee *emp[3]; emp[0] = new ProductionWorker("John", "12345", 40, 30, 1); emp[1] = new ShiftSupervisor("Joe", "22222", 40000, 5000); emp[2] = new ProductionWorker("Jane", "33333", 35, 50, 2); for (int i = 0; i < 3; i++) { emp[i]->print(); cout << '\n'; } return 0; }