Print Fees Slip In C# Program.
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Array_Practise1
{
class Program
{
static void Main(string[] args)
{
double dis = 0,pay;
double tfees=0;
Console.WriteLine("Enter Your Name");
string sname = Convert.ToString(Console.ReadLine());
Console.WriteLine("Enter Your Registration No");
int reg = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Departmrnt");
string dep = Convert.ToString(Console.ReadLine());
Console.WriteLine("Enter your no of Courses");
int n = Convert.ToInt32(Console.ReadLine());
string[] cname = new string[n];
double[] fees = new double[n];
int[] chrs = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("Enter your Course Name");
cname[i] = Console.ReadLine();
Console.WriteLine("Enter Credit Hours");
chrs[i] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter chrs rate price");
int rate = Convert.ToInt32(Console.ReadLine());
fees[i] = rate * chrs[i];
tfees += fees[i];
}
Console.WriteLine("Enter your Category(1-4)");
Console.WriteLine("1.Naval");
Console.WriteLine("2.Army");
Console.WriteLine("3.other");
int choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
case 1:
dis=tfees* 0.5;
break;
case 2:
dis = tfees * 0.3;
break;
case 3:
dis = tfees * 0;
break;
default:
Console.WriteLine("invalid term");
break;
}
Console.WriteLine("=================FEES SLIP==================");
Console.WriteLine("Student Name:{0}",sname);
Console.WriteLine("Roll No:{0}",reg);
Console.WriteLine("Department:{0}\n",dep);
Console.WriteLine("----------------------------------------------");
Console.WriteLine("Course Name\t chrs\t fees\t");
Console.WriteLine("-----------------------------------------------");
for (int i = 0; i < n ; i++)
{
Console.WriteLine("{0}\t\t| {1}\t| {2}\t|",cname[i],chrs[i],fees[i]);
}
Console.WriteLine("Total Fees:{0}", tfees);
Console.WriteLine("Discounted:{0}", dis);
pay = tfees - dis;
Console.WriteLine("Total Payable Amount:{0}", pay);
}
}
}
Comments
Post a Comment