Question: Question 1 Every employee has an ID , a first name and surname, and a means of payment. A salaried employee is paid a salary

Question 1 Every employee has an ID, a first name and surname, and a means of payment. A
salaried employee is paid a salary once a month.
An hourly paid employee is paid an amount calculated once a month from the number
of hours worked. Whenever the employee works, the number of hours can be
incremented. The amount paid is simply the total number of hours multiplied by the
hourly rate.
Someone employed on a commission basis is paid a commission once a month
calculated from the total of all the sales they made in the month. Whenever a sale is
made, the total sales can be increased. The amount paid is simply the commission rate
multiplied by the total sales.
Implement the five classes Employee, Payment, Salary, Hourly and Commission.
Note the following:
These classes must each have their definitions and implementations in separate
header and source files.
The Employee class should allocate unique IDs to each new Employee instance,
starting with the number 1001. The static data member nextID should therefore be
initialised appropriately, assigned to the id of each new instance, and incremented accordingly.
Since Employee instances each contain a Payment and access it by means of a
pointer, the Employee class needs to implement a copy constructor (to do a deep
copy) and a destructor to deallocate the memory of the Payment.
The Payment class has an abstract member function pay() that must be
implemented by each of its (concrete) subclasses to calculate the monthly payment as
described above.
The type data member of the Payment class is protected to allow it to be initialised
by the constructors of the Salary, Hourly and Commission classes.
You can assume that the system using these classes will call the addHours () and
addSales() member functions on relevant instances of hourly and commission
payments of employees as required (see below.)
Implement another class called EmployeeList according to the following UML
diagram:
Note that the member functions and data members of the QList and Employee
classes are not provided in this diagram. They are as provided in the QList definition
in the Qt class reference, and as in the UML diagram at the beginning of this question,
respectively.
Note the following about the EmployeeList class: EmployeeList inherits from the class template QList, but is not templatized itself.
All its elements are Employees.
EmployeeList inherits all the member functions of QList, so it need not implement
any of its own.
Write a program (a console application) to test the member functions of the
Employee class and the Payment subclasses. It should do the following:
Add at least six employees (including at least two of each of the concrete
subclasses of
Payment) to an EmployeeList.
Call the addHours () member function on the Hourly payment of at least one
instance of an hourly paid employee that has been stored in the list.
Call the addSales() member functions on the commission payment of at
least one instance of a commission paid employee in the list.
Display a report of the payments owed to each employee at the end of the month,
grouped into salaried, hourly paid and commission paid employees.
The following UML diagram specifies a number of classes that model employees
and different
kinds of payments:
Question 1 Every employee has an ID , a first

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!