class Employee{
double salary,gross,tax=0;
String name,empid;
public Employee(){
gross=0;
tax=0;
salary=0;
name="null";
empid="null";
}
public Employee(String nme,String eid,double sal){
salary=sal;
empid=eid;
name=nme;
}
public double increase_Salary(double percent){
return salary=(salary+((percent*salary)/100));
}
public double calculate_tax(){
if(salary>=100000&& salary<150000){
tax=(10*(salary/100));
}
else if(salary>=150000){
tax=(20*(salary/100));
}
return tax;
}
public double gross_salary(){
if(salary>=100000&& salary<150000){
gross=(salary-(10*(salary/100)));
}
else if(salary>=150000){
gross=salary-(20*(salary/100));
}
return gross;
}
public void display(){
for (int i=1;i<=12;i++){
if(i==1){
System.out.println(i+" "+name+" "+"JAN"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==2){
System.out.println(i+" "+name+" "+"FEB"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==3){
System.out.println(i+" "+name+" "+"MAR"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==4){
System.out.println(i+" "+name+" "+"APR"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==5){
System.out.println(i+" "+name+" "+"MAY"+" "+empid+" "+salary+" "+(calculate_tax()/12)+" "+(gross_salary()/12)+" "+(increase_Salary(20)/12));
}
if(i==6){
System.out.println(i+" "+name+" "+"JUN"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==7){
System.out.println(i+" "+name+" "+"JUL"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==8){
System.out.println(i+" "+name+" "+"AUG"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==9){
System.out.println(i+" "+name+" "+"SEP"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==10){
System.out.println(i+" "+name+" "+"OCT"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==11){
System.out.println(i+" "+name+" "+"NOV"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==12){
System.out.println(i+" "+name+" "+"DEC"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
}
}
public static void main(String[] args){
Employee emp=new Employee("Nikhil Jain","R101",2400000);
emp.display();
}
}
double salary,gross,tax=0;
String name,empid;
public Employee(){
gross=0;
tax=0;
salary=0;
name="null";
empid="null";
}
public Employee(String nme,String eid,double sal){
salary=sal;
empid=eid;
name=nme;
}
public double increase_Salary(double percent){
return salary=(salary+((percent*salary)/100));
}
public double calculate_tax(){
if(salary>=100000&& salary<150000){
tax=(10*(salary/100));
}
else if(salary>=150000){
tax=(20*(salary/100));
}
return tax;
}
public double gross_salary(){
if(salary>=100000&& salary<150000){
gross=(salary-(10*(salary/100)));
}
else if(salary>=150000){
gross=salary-(20*(salary/100));
}
return gross;
}
public void display(){
for (int i=1;i<=12;i++){
if(i==1){
System.out.println(i+" "+name+" "+"JAN"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==2){
System.out.println(i+" "+name+" "+"FEB"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==3){
System.out.println(i+" "+name+" "+"MAR"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==4){
System.out.println(i+" "+name+" "+"APR"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==5){
System.out.println(i+" "+name+" "+"MAY"+" "+empid+" "+salary+" "+(calculate_tax()/12)+" "+(gross_salary()/12)+" "+(increase_Salary(20)/12));
}
if(i==6){
System.out.println(i+" "+name+" "+"JUN"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==7){
System.out.println(i+" "+name+" "+"JUL"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==8){
System.out.println(i+" "+name+" "+"AUG"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==9){
System.out.println(i+" "+name+" "+"SEP"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==10){
System.out.println(i+" "+name+" "+"OCT"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==11){
System.out.println(i+" "+name+" "+"NOV"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
if(i==12){
System.out.println(i+" "+name+" "+"DEC"+" "+empid+" "+(salary/12)+" "+(calculate_tax()/12)+" "+(gross_salary()/12));
}
}
}
public static void main(String[] args){
Employee emp=new Employee("Nikhil Jain","R101",2400000);
emp.display();
}
}
No comments:
Post a Comment