In a college library fines are issued according to the following condition
If return books exceeds the due date
Up to 5 days 20rs fine
6-10 days 50rs fine
>10 days 100rs fine
More than 30 days membership will be cancelled
Get the due date from the user and calculate ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Get the due Date :");
//new DateTime(2011, 10, 25);
string date = Convert.ToString(Console.ReadLine());
DateTime diff_due = Convert.ToDateTime(date);
var dt2 = DateTime.Now;
TimeSpan ts = diff_due - dt2;
int diff = ts.Days;
if (diff_due > dt2)
{
Console.WriteLine("Invalid Date you Typed !!!");
}
else if (diff < 0)
{
Console.WriteLine("Still U have more days");
}
else if (diff <= 5 && diff >= 0)
{
Console.WriteLine("Fine Rs-20");
}
else if (diff <= 10)
{
Console.WriteLine("Fine Rs-50");
}
else if (diff < 30)
{
Console.WriteLine("Fine Rs-100");
}
else if (diff > 30)
{
Console.WriteLine("Membership Canceled");
}
Console.ReadLine();
}
}
}