Tuesday, 27 November 2012

Employee Paybill Preparation

using System;
using System.Collections.Generic;
using System.Text;

namespace employee
{
class employ
{
protected int id, basic;
protected string name;
public void getdata()
{
Console.WriteLine("Enter the Employee ID");
id = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Employee Name");
name = Console.ReadLine();
Console.WriteLine("Enter the basic salary");
basic = int.Parse(Console.ReadLine());
}
}
class staff:employ
{
double hra = 0.05, da = 0.04, pf = 0.03, it = 0.05;
double hra1,da1,pf1,it1,az,ad,net;
public void calculate()
{
hra1 = hra * basic;
da1 = da * basic;
pf1 = pf * basic;
it1 = it * basic;
az = (da1 + hra1);
ad = (pf1 + it1);
net = (basic + az - ad);
}
public void display()
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}",id,name,basic,hra1,da1,pf1,it1,net);
}
}
class emp
{

static void Main(string[] args)
{
int i, n;
staff[] s = new staff[20];
Console.WriteLine("Enter the no of Employee");
n = int.Parse(Console.ReadLine());
for (i = 0; i < n; i++)
{
s[i] = new staff();
s[i].getdata();
s[i].calculate();
}
Console.WriteLine("Employee Paybill perparation");
Console.WriteLine("ID\tNAME\tBASIC\tHRA\tDA\tPF\tIT\tNET");

for (i = 0; i < n; i++)
{
s[i].display();
}



}
}
}

No comments:

Post a Comment