using std::cout; using std::cin; using std::endl; using std::fixed; #include using std::setprecision; #include using std::vector; #include #include #include #include "employee.h" // Employee base class #include "salaried.h" // SalariedEmployee class #include "commission.h" // CommissionEmployee class #include "baseplus.h" // BasePlusCommissionEmployee class #include "hourly.h" // HourlyEmployee class int main() { int month; cout << "Please enter the current month in its numerical value ( i.e." << " december = 12\n January = 01, etc. :" <> month; // set floating-point output formatting cout << fixed << setprecision( 2 ); // create vector employees vector < Employee * > employees( 4 ); // initialize vector with Employees employees[ 0 ] = new SalariedEmployee( "John", "Smith", "111-11-1111", "03", 800.00 ); employees[ 1 ] = new CommissionEmployee( "Sue", "Jones", "222-22-2222","12", 9, 8 ); //first, last, social, birthmonth, commission, grossSales employees[ 2 ] = new BasePlusCommissionEmployee( "Bob", "Lewis", "333-33-3333", "10", 2, 3, 1965 ); employees[ 3 ] = new HourlyEmployee( "Karen", "Price", "444-44-4444", "08", 12, 29 ); // process each element in vector employees for ( int i = 0; i < employees.size(); i++ ) { // output each employees information employees[ i ]->print(); /*if (employees[i]->getBirthDate() == month) { cout << " Happy Birthday! It is the month of your birthday! " <earnings()+=100; cout<< " Your monthly earnings are now $" << employees[ i ]->earnings() < ( employees[ i ] ); // determine whether element points to base-salaried // commission worker if ( commissionPtr != 0 ) { cout << "old base salary: $" << commissionPtr->getBaseSalary() << endl; commissionPtr->setBaseSalary( 1.10 * commissionPtr->getBaseSalary() ); cout << "new base salary with 10% increase is: $" << commissionPtr->getBaseSalary() << endl; } // end if // release memory held by vector employees for ( int j = 0; j < employees.size(); j++ ) { // output class name cout << "\ndeleting object of " << typeid( *employees[ j ] ).name(); delete employees[ j ]; } // end for cout << endl; return 0; } // end main }