Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<p>Modify the payroll system of&#160;<a class=\"docLink\" href=\"http://www.gibm

ID: 3624747 • Letter: #

Question

<p>Modify the payroll system of&#160;<a class="docLink" href="http://www.gibmonks.com/c_plus/ch13lev1sec6.html#ch13fig13">Figs. 13.13</a><a class="docLink" href="http://www.gibmonks.com/c_plus/ch13lev1sec6.html#ch13fig23">13.23</a>&#160;to include&#160;<tt>private</tt>&#160;data member&#160;<tt>birthDate</tt>&#160;in class&#160;<tt>Employee</tt>. Use class&#160;<tt>Date</tt>&#160;from&#160;<a class="docLink" href="http://www.gibmonks.com/c_plus/ch11lev1sec12.html#ch11fig12">Figs. 11.12</a><a class="docLink" href="http://www.gibmonks.com/c_plus/ch11lev1sec12.html#ch11fig13">11.13</a>&#160;to represent an employee's birthday. Assume that payroll is processed once per month. Create a&#160;<tt>vector</tt>&#160;of&#160;<tt>Employee</tt>&#160;references to store the various employee objects. In a loop, calculate the payroll for each&#160;<tt>Employee</tt>&#160;(polymorphically), and add a $100.00 bonus to the person's payroll amount if the current month is the month in which the&#160;<tt>Employee</tt>'s birthday occurs.</p>

Explanation / Answer

Dear, Here is the code // Employee abstract base class. #ifndef EMPLOYEE_H #define EMPLOYEE_H #include // C++ standard string class using std::string; #include "Date.h" // Date class definition class Employee { public: Employee( const string &, const string &, const string &,int, int, int ); void setFirstName( const string & ); // set first name string getFirstName() const; // return first name void setLastName( const string & ); // set last name string getLastName() const; // return last name void setSocialSecurityNumber( const string & ); // set SSN string getSocialSecurityNumber() const; // return SSN void setBirthDate( int, int, int ); // set birthday Date getBirthDate() const; // return birthday // pure virtual function makes Employee abstract //base class virtual double earnings() const = 0; // pure virtual virtual void print() const; // virtual private: string firstName; string lastName; string socialSecurityNumber; Date birthDate; // the Employee's birthday }; // end class Employee #endif // EMPLOYEE_H ________________________________________________________________________ //employee.cpp #include using std::cout; #include "Employee.h" // Employee class definition // constructor Employee::Employee( const string &first, const string &last, const string &ssn, int month, int day, int year ) : firstName( first ), lastName( last ), socialSecurityNumber( ssn ), birthDate( month, day, year ) { // empty body } // end Employee constructor // set first name void Employee::setFirstName( const string &first ) { firstName = first; } // end function setFirstName // return first name string Employee::getFirstName() const { return firstName; } // end function getFirstName // set last name void Employee::setLastName( const string &last ) { lastName = last; } // end function setLastName // return last name string Employee::getLastName() const { return lastName; } // end function getLastName // set social security number void Employee::setSocialSecurityNumber( const string &ssn ) { socialSecurityNumber = ssn; // should validate } // end function setSocialSecurityNumber // return social security number string Employee::getSocialSecurityNumber() const { return socialSecurityNumber; } // end function getSocialSecurityNumber // set birthday void Employee::setBirthDate( int month, int day, int year ) { birthDate.setDate( month, day, year ); } // end function setBirthDate // return birthday Date Employee::getBirthDate() const { return birthDate; } // end function getBirthDate // print Employee's information (virtual, but not pure virtual) void Employee::print() const { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote