
Solution is given Below
using System;
namespace cs411
{
class Zakat
{
public virtual void zakat_Calculation(int amount)
{
Console.WriteLine(“Calculating Rupees Zakat”);
Console.WriteLine(“Total Zakat to be Paid : ” + amount * 0.025);
}
}
class Gold_Zakat : Zakat
{
public override void zakat_Calculation(int amount)
{
float one_ounce_amount = 1821;
if (((float)amount / one_ounce_amount) >= 3.08)
{
// Because Zakat is on 7.5 tola Gold and 3.08 ounce
// is equal to 7.5 tola Gold.
Console.WriteLine(“Calculating Gold Zakat”);
Console.WriteLine(“Total Zakat to be Paid : ” + amount * 0.025);
}
else
{
Console.WriteLine(“Your Amount is not enough for Gold Zakat”);
}
}
}
class Silver_Zakat : Zakat
{
public override void zakat_Calculation(int amount)
{
float one_ounce_amount = 28;
if (((float)amount / one_ounce_amount) >= 21.59)
{
// Because Zakat is on 52.5 tola Silver and 21.59 ounce
// is equal to 52.5 tola Silver.
Console.WriteLine(“Calculating Silver Zakat”);
Console.WriteLine(“Total Zakat to be Paid : ” + amount * 0.025);
}
else
{
Console.WriteLine(“Your Amount is not enough for Silver Zakat”);
}
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Enter the Numeric Characters of Your VU ID as your Assets”); ;
int vuid = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“If you want to calculate Zakat of your amount in rupees Then Press 1” +
“\nIf you want to calculate Zakat of your amount in Gold Then Press 2” +
“\nIf you want to calculate Zakat of your amount in Silver Then Press 3”); ;
int option = Convert.ToInt32(Console.ReadLine());
switch (option)
{
case 1:
Zakat zakat = new Zakat();
zakat.zakat_Calculation(vuid);
break;
case 2:
Zakat gold_zakat = new Gold_Zakat();
gold_zakat.zakat_Calculation(vuid);
break;
case 3:
Zakat silver_zakat = new Silver_Zakat();
silver_zakat.zakat_Calculation(vuid);
break;
default:
Console.WriteLine(“Enter Correct Number”);
break;
}
}
}
}
Leave a Reply