Posted: November 1st, 2022

Cs 1410 programming lab #10 templates and polymorphism with virtual

CS 1410 Programming Lab #10
Templates and Polymorphism with Virtual Functions
Assignment
Modify the code from Lab #9, making Employee into an abstract class and adding a virtual
function to SalesEmployee, SalariedEmployee, and WagedEmployee. Modify the Lab #9 driver
program to place employee objects into a circularly linked list as demonstrated in class.
1. Modify the CList class to make it a “templatized” class
a.
Copy the code from CList.cpp into Clist.h (between the class declaration and the
closing #endif)
b.
Add “template <class T>” before the class and before each member function
c.
Modify all function signatures to reflect the templatized class scope: CList<T>::
d.
Replace Employee with T 2. Modify the Lab #9 driver to place the instantiated employee objects into an instance of
CList
a.
Include the CList header file
b.
Instantiate a circularly linked list
c.
Insert each new employee object (e.g., we and se) in the list
d.
Discard the cout statements at the end of cases 1, 2, and 3
e.
Implement case 4, which calls the CList list function 3. Employee class
a.
Make the Employee class abstract by adding a pure virtual function named
calcPay:
virtual double calcPay() = 0;
b.
Add a “getName” function to return the employee’s name (this is an accessor or
getter function)
c.
Add a virtual display function to display (to cout) the employee’s name,
address, and birth date 4. WagedEmployee class
a.
Add a virtual function named calcPay: double calcPay() to calculate and
return a waged employee’s pay
i.
A waged employee’s pay is his/her wage times the hours worked
b.
Add a virtual display function that
i.
Calls the Employee display function
ii.
Displays the employee’s wage, hours, and pay (i.e., calls calcPay) Page 1 of 2 5. SalariedEmployee class
a.
Add a virtual function named calcPay: double calcPay()
i.
A salaried employee’s pay is his/her salary divided by 24
b.
Add a virtual display function that
i.
Calls the Employee display function
ii.
Displays the employee’s salary and pay (i.e., calls calcPay) 6. SalesEmployee class
a.
Add a virtual function named calcPay: double calcPay()
i.
A sales employee’s pay is his/her salary (call the salaried employee’s
calcPay function) plus commission times sales
b.
Add a virtual display function that
i.
Calls the salaried employee’s display function
ii.
Displays the employees commission, total sales, and pay (i.e., calls
calcPay) Grading
Upload eight files (Driver.cpp, Employee.h, SalariedEmployee.h, WagedEmployee.h,
SalesEmployee.h, Address.h, Date.h, and CList.h) to Canvas for grading Page 2 of 2

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
error: Content is protected !!
Open chat
1
Order through WhatsApp!
affordablepaperwritings.com
Hello!
You Can Now Place your Order through WhatsApp
 

 

 

Order your essay today and save 15% with the discount code DISCOUNTS2023