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)
#include <iostream>
using namespace std;
int main()
{
float money, zakat, gold;
cout<<"Enter the gold you have: ";
cin >> gold;
money = gold*71200;
zakat = (money/100)*2.5;
cout<<"Your payable zakat is "<<zakat;
return 0;
}
Comments
Leave a comment