Create a class called Scholarship which has a function Public void Merit() that takes marks and fees as an input. Merit method should get an marks as input using params
If the given mark is >= 70 and <=80, then calculate scholarship amount as 20% of the fees
If the given mark is > 80 and <=90, then calculate scholarship amount as 30% of the fees
If the given mark is >90, then calculate scholarship amount as 50% of the fees.
In all the cases return the Scholarship amount
class Scholarship
{
public void Merit(double marks, double fees)
{
if (marks >= 70 && marks <= 80)
{
Console.WriteLine($"Scholarship amount: {0.2 * fees}");
}
else if (marks > 80 && marks <= 90)
{
Console.WriteLine($"Scholarship amount: {0.3 * fees}");
}
else if (marks > 90)
{
Console.WriteLine($"Scholarship amount: {0.5 * fees}");
}
}
}
internal class Program
{
static void Main(string[] args)
{
Scholarship scholarship = new Scholarship();
scholarship.Merit(95, 10000);
Console.ReadKey();
}
}
Comments
Leave a comment