www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS411 Assignment 01 Spring 2021 Solution / Discussion

(Marks 20)

Problem Statement:

You are required to create a C# Console application using Visual Studio.

Your code should be able to calculate Zakat for gold, silver and cash in hand separately while using the concept of POLYMORPHISM.

• Your code should work in such a way that you need to create 3 classes, one parent class and other two derived classes.
• The function that needs to be override would be of Zakat Calculation.
• For calculating Zakat for cash, you simple have to multiply your amount with 0.025, if you want to calculate it for silver or gold, first you need to know the price of 1 ounce of silver and 1 tola gold in rupees respectively and then calculate zakat afterwards.
• When you run your code, your code should ask to enter your vu id as an asset on which zakat has to be calculated.
• After that, you will be given a choice as shown in the output of selecting whether the entered asset is cash in hand, gold or silver.
• You should choose the category of your choice and screenshot it.

Required Output:

Note:

DO REMEMBER that you must use your VUID as an input in this program.

 Submission details Following Files Must be submitted in a single zip or rar file. ·         .cs code file (file name should be your VUID) ·         Screenshot of your output while running three of the conditions. You are not required to submit the complete project, only copy required file from project folder.

If you do not submit any of the above-mentioned file you will be awarded Marks partially.

“The End”

Views: 918

### Replies to This Discussion

Share the Assignment Questions & Discuss Here....

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

# CS411 Assignment 01 Spring 2021 Solution Complete solution

CS411_Assignment%2301_Solution-Spring_2021-Complete-Solution.pdf

CS411 Complete Solution File

CS411_Assignment%2301_Solution-Spring_2021-Complete-Solution.docx

# Cs411 Assignment1 100% Right Solution With Source Code.

#CS411_Assignment_Solution_Spring_2021​.

# CS411 Assignment 01 Spring 2021 Solution Complete solution

CS411_Assignment%2301_Solution-Spring_2021-Complete-Solution.pdf

# CS411 Assignment 01 Spring 2021 Solution

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"); ;

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"); ;

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;
}

}
}
}

CS411 Complete Solution File

CS411_Assignment%2301_Solution-Spring_2021-Complete-Solution.docx

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

Mani Siddiqui posted a status
"کسی کا عہد گذشتہ کسی کا حال تھی وہ ہزار نقص تھے اس میں مگر کمال تھی وہ"
1 hour ago
naveed asmat mirza joined + M.Tariq Malik's group

1 hour ago

1 hour ago

1 hour ago

### jkju

2 hours ago
Mani Siddiqui posted a status
"Life is a gamE uhh caN BE a playeR oR a toY"
2 hours ago

2 hours ago

2 hours ago