Cs1230 Oop Final Sp21
Cs1230 Oop Final Sp21
Question 4: An Islamic bank wants you to develop a Zakat Calculator for them. The calculator shall
take the input of the 1) name of zakat donor, 2) Bank_Balance, 3) zakat_amount. Create constructor to
initialize variables with default values which will be called on the time of object instantiation. There
should be a method named “Cal_zakat()” which calculates the zakat of each donor and set in
zakat_amount. The program adds up the zakat of each donor hence calculating the total_zakat of the
bank. Use a “display()” which displays not only the data of the donor but also the total amount of
zakat of the bank. It should keep in mind that the zakat will be calculated only if Bank_Balance is
greater than or equal to 20,000. (You should implement the concept of overloading, copy constructor
or overriding wherever it is applicable)
Note: Zakat will be calculated by the formula (Bank_Balance *2.5)/100. [12 Marks]
Question 5: Create a class Worker with attributes name, age and salary. This class contain default
constructor, getData, Display and a pure virtual function named as calculate commission with a virtual
destructor.
a) A class Salaried that inherits from Worker contain parameterize constructor and a function
that calculates the commission of the worker and display total salary constantly.
b) A class Hourly that inherits from Worker calculates the commission of Worker with of 5%
and display total salary constantly. Instantiate Salaried and Hourly classes polymorphically.
Note: Commission of an employee of Salaried class is 10% and for class Hourly employee is 5%.
[13 Marks]
************Good Luck***************