import
java.text.*;
class
Employee
{
int
Empno;
double
Basic,DA,HRA;
String
Empname;
void
readdata(int x,String y)
{
Empno=x;
Empname=y;
}
void
readsalary(double x,double y,double z)
{
Basic=x;
DA=y;
HRA=z;
}
void
printdata()
{
System.out.println("Employee
Number:"+Empno);
System.out.println("Employee
Name :"+Empname);
}
void
printsalary()
{
DecimalFormat
df=new DecimalFormat("0.00");
System.out.println("Employee
Basic :"+df.format(Basic));
System.out.println("Employee
DA :"+df.format(DA));
System.out.println("Employee
HRA :"+df.format(HRA));
}
}
class
TSalary extends Employee
{
void
showdata()
{
readdata(111,"Vishnu");
printdata();
readsalary(2589.00,567,1090);
printsalary();
}
void
calsalary()
{
DecimalFormat
df=new DecimalFormat("0.00");
double
netsal;
netsal=Basic+DA+HRA;
System.out.println("Employee
Netsalary="+df.format(netsal));
}
}
class
PSalary extends Employee
{
double
Itax;
void
readtax(double x)
{
Itax=x;
}
void
showdata()
{
readdata(1000,"Kamal");
printdata();
readsalary(12589.00,1567,2090);
printsalary();
}
void
calsalary()
{
DecimalFormat
df=new DecimalFormat("0.00");
double
Gsal,netsal;
Gsal=Basic+DA+HRA;
netsal=Gsal-Itax;
System.out.println("Income
Tax Amount="+df.format(Itax));
System.out.println("Employee
Netsalary="+df.format(netsal));
}
}
class
Harch
{
public static void main(String[]
args)
{
TSalary obj=new TSalary();
obj.showdata();
obj.calsalary();
PSalary obj1=new PSalary();
obj1.readtax(800);
obj1.showdata();
obj1.calsalary();
}
}
No comments:
Post a Comment