Closed ErSKS closed 7 years ago
/*
/*
@author kajal */ public class Inheritance3 {
/**
@param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here PermanentEmployee ganesh = new PermanentEmployee();
ganesh.setName("Bikash"); ganesh.setSalary(35000); ganesh.setDepartment("Computer"); ganesh.setPf(true); ganesh.setSalaryInc(0.1f); ganesh.setTax(0.2f);
float i = (ganesh.getSalaryInc() ganesh.getSalary()); float t = (ganesh.getTax() i); float s = (ganesh.getSalary() + i - t);
System.out.println("Permanent Employee:"); System.out.println("Name:" + ganesh.getName()); System.out.println("Department:" + ganesh.getDepartment()); System.out.println("Pf:" + ganesh.isPf()); System.out.println("Salary:" + s);
TemporaryEmployee ravi = new TemporaryEmployee();
ravi.setName("Ram"); ravi.setSalary(35000); ravi.setDepartment("Computer"); ravi.setPf(false); ravi.setTax(.15f);
float a = (ravi.getSalary() - ravi.getTax() * ravi.getSalary()); System.out.println(""); System.out.println("Temporary Employee:"); System.out.println("Name:" + ravi.getName()); System.out.println("Department" + ravi.getDepartment()); System.out.println("Pf" + ravi.isPf()); System.out.println("Salary:" + a);
}
}
/*
/*
@author som */ public class Employee {
private String name; private String department; private float salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
public float getSalary() { return salary; }
public void setSalary(float salary) { this.salary = salary; }
}
/*
/*
@author kajal */ public class PermanentEmployee extends Employee{ private boolean pf = true; private float tax; private float salaryInc;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getTax() { return tax; }
public void setTax(float tax) { this.tax = tax; }
public float getSalaryInc() { return salaryInc; }
public void setSalaryInc(float salaryInc) { this.salaryInc = salaryInc; }
}
/*
/*
@author kajal */ public class TemporaryEmployee extends Employee{ private float tax; private boolean pf = false;
public float getTax() { return tax; }
public void setTax(float tax) { this.tax = tax; }
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; } }
package employeedetail;
/*
@author m-lan */ public class EmployeeDetail {
/**
@param args the command line arguments */ public static void main(String[] args) { PermanentEmployee E1 = new PermanentEmployee(); TemporaryEmployee E2 = new TemporaryEmployee(); E1.setName("Milan Adhikari"); E1.setDepartment("Computer"); E1.setSalary(500000); E2.setName("Sahas Dongol"); E2.setDepartment("Civil"); E2.setSalary(200000);
System.out.println("Permanent Employee"); System.out.println("pf: " + E1.isPf()); System.out.println("Name: " + E1.getName()); System.out.println("Department: " + E1.getDepartment()); System.out.println("Final Salary: Rs." + E1.getSalary()); System.out.println(""); System.out.println("Temporary Employee"); System.out.println("pf: " + E2.isPf()); System.out.println("Name: " + E2.getName()); System.out.println("Department: " + E2.getDepartment()); System.out.println("Final Salary: Rs." + E2.getSalary()); }
}
Class Employee
package employeedetail;
/*
@author m-lan */ public class Employee {
private String Name; private String Department; private double salary;
public String getName() { return Name; }
public void setName(String Name) { this.Name = Name; }
public String getDepartment() { return Department; }
public void setDepartment(String Department) { this.Department = Department; }
public double getSalary() { return salary; }
public void setSalary(double salary) { PermanentEmployee E1 = new PermanentEmployee(); TemporaryEmployee E2 = new TemporaryEmployee(); if (this instanceof PermanentEmployee) { this.salary = E1.finalSalary(salary); } else { this.salary = E2.finalSalary(salary); }
} }
Class Permanent Employee
package employeedetail;
/*
@author m-lan */ public class PermanentEmployee extends Employee {
private boolean pf = true;
public boolean isPf() { return pf; }
double finalSalary(double s) { s += s 0.1; s -= s 0.2; return s; } }
Class TemporaryEmployee package employeedetail;
/*
@author m-lan */ public class TemporaryEmployee extends Employee {
private boolean pf = false;
public boolean isPf() { return pf; }
double finalSalary(double s) { s -= s * 0.15; return s; } }
Output
package task14august2;
/*
@author Jagdish Duwal */ public class Task14August2 {
/**
@param args the command line arguments */ public static void main(String[] args) { PermanentEmployee p = new PermanentEmployee(); p.setName("Ram"); p.setDept("Human Resources"); p.setSalary(50000);
System.out.println("Permanent Employee Description:"); System.out.println("name: "+ p.getName()); System.out.println("Department: "+ p.getDept()); System.out.println("New Salary: "+ p.calcNewSalary(p.getSalary())); System.out.println("Tax: "+ p.calcTax(p.calcNewSalary(p.getSalary())));
TemporaryEmployee t = new TemporaryEmployee(); t.setName("Sam"); t.setDept("IT Dept"); t.setSalary(10000);
System.out.println("Temporary Employee Description:"); System.out.println("name: "+ t.getName()); System.out.println("Department: "+ t.getDept()); System.out.println("Salary: "+ t.getSalary()); System.out.println("Tax: "+ t.calcTax(t.getSalary())); }
}
class Employee
package task14august2;
/*
@author Jagdish Duwal */ public class Employee { private String name; private String dept; private double salary=0;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDept() { return dept; }
public void setDept(String dept) { this.dept = dept; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; }
}
class PermanentEmployee
package task14august2;
/*
@author Jagdish Duwal */ public class PermanentEmployee extends Employee { boolean pf = true;
double tax;
double newSalary;
double calcNewSalary(double salary){
salary += 0.1 * salary;
return salary;
}
double calcTax(double nSalary){ double tax; tax = 0.2 * nSalary;
return tax;
} }
class TemporaryEmployee
package task14august2;
/*
@author Jagdish Duwal */ public class TemporaryEmployee extends Employee{ boolean pf = false; double tax;
double calcTax(double salary){ double tax; tax = 0.2 * salary;
return tax;
}
}
/*
/*
@author Anish */ public class Day11_1 {
/**
} /*
/*
@author Anish */ public class Employee {
private String dept; private String name; private double salary;
public String getDept() { return dept; }
public void setDept(String dept) { this.dept = dept; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; } } /*
/*
@author Anish */ public class PermanentEmployee extends Employee {
private boolean pf = true; private double sal = 0.1; private double tax = 0.2;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public double getSal() { return sal; }
public void setSal(double sal) { this.sal = sal; }
public double getTax() { return tax; }
public void setTax(double tax) { this.tax = tax; }
} /*
/*
@author Anish */ public class TemporaryEmployee extends Employee {
private boolean pf = false; private double tax = 0.15;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public double getTax() { return tax; }
public void setTax(double tax) { this.tax = tax; } }
/*
/*
@author Dell */ public class EmployeeImplementationn {
/**
@param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here TemporaryEmployee ga = new TemporaryEmployee(); ga.setName("ganesh"); ga.setDept("manager"); ga.setSalary(35000); System.out.println("name:" + ga.getName()); System.out.println("departmenr:" + ga.getDept()); System.out.println("salary:" + ga.getSalary()); System.out.println("tax:" + ga.getTax()); System.out.println("pf:" + ga.isPf());
System.out.println("########################################"); PermanentEmployee hari = new PermanentEmployee(); hari.setName("hari"); hari.setDept("ceo"); hari.setSalary(35000); System.out.println("name:" + hari.getName()); System.out.println("departmenr:" + hari.getDept()); System.out.println("salary:" + hari.getSalary()); System.out.println("tax:" + hari.getTax()); System.out.println("pf:" + hari.isPf()); }
}
public class Employee {
private String name;
private String dept;
public double salary;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
public class PermanentEmployee extends Employee {
private boolean pf = true;
private double salary;
private double tax;
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
public double getSalary() {
salary = salary + (salary * 0.1);
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public double getTax() {
tax = salary * 0.2;
return tax;
}
public void setTax(double tax) {
this.tax = tax;
}
}
public class TemporaryEmployee extends Employee {
private boolean pf = false;
private double tax;
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
public double getTax() {
tax = salary * 0.15;
return tax;
}
public void setTax(double tax) {
this.tax = tax;
}
}
/*
/*
@author DELL */ public class EmployeImplementation {
/**
@param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here TemporaryEmployee t = new TemporaryEmployee();
t.setName("Ravi"); t.setSalary(35000); t.setPf(false); t.setDepartment("Civil"); t.setTax2(500); System.out.println("Temporary :\nName : " + t.getName() + "\nDepartment : " + t.getDepartment() + "\nPf : " + t.isPf() + "\nSalary : " + (t.getSalary()) + "\nTax : " + (t.getTax2() * .15 + t.getTax2()));
PermanentEmployee p = new PermanentEmployee(); p.setName("Ganesh"); p.setSalary(35000); p.setPf(true); p.setDepartment("Computer"); p.setTax1(500); System.out.println("\nPermanent :\nName : " + p.getName() + "\nDepartment : " + p.getDepartment() + "\nPf : " + p.isPf() + "\nSalary : " + (p.getSalary() 0.1 + p.getSalary()) + "\nTax : " + (p.getTax1() .20 + p.getTax1()));
}
}
/*
/*
@author DELL */ public class Employee {
String name; String department; int salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
public int getSalary() { return salary; }
public void setSalary(int salary) { this.salary = salary; }
}
/*
/*
@author DELL */ public class PermanentEmployee extends Employee {
private boolean pf; private double sal; private double tax1;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public double getSal() { return (sal); }
public void setSal(double sal) { this.sal = sal;
}
public double getTax1() { return tax1; }
public void setTax1(double tax1) { this.tax1 = tax1; } }
/*
/*
@author DELL */ public class TemporaryEmployee extends Employee {
private boolean pf; private int tax2;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public int getTax2() { return tax2; }
public void setTax2(int tax2) { this.tax2 = tax2; } }
OUTPUT
/*
import java.util.Scanner;
/*
@author mahesh */ public class EmployeeImplementaion {
/**
@param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here PermanentEmployee p1 = new PermanentEmployee(); TemporaryEmployee t1 = new TemporaryEmployee(); Scanner ip = new Scanner(System.in); System.out.println("Enter Details of Permanent Employee"); System.out.println("Name = "); p1.setName(ip.nextLine()); System.out.println("Department = "); p1.setDept(ip.nextLine()); System.out.println("Salary (€) = "); p1.setSal(ip.nextDouble()); System.out.println(""); System.out.println("Enter Details of Temporary Employee"); System.out.println("Name = "); t1.setName(ip.nextLine()); t1.setName(ip.nextLine()); System.out.println("Department = "); t1.setDept(ip.nextLine()); System.out.println("Salary (€) = "); t1.setSal(ip.nextDouble());
System.out.println("Details of Permanent Employee:"); System.out.println("Name: " + p1.getName() + "\tDepartment: " + p1.getDept() + "\nSalary: €" + p1.getSal() + "\tProvident Fund Availablity: " + p1.pf + "\nTotal Salary: €" + p1.newsal() + "\tTax Amount: €" + p1.tax()); System.out.println(); System.out.println("Details of Temporary Employee:"); System.out.println("Name: " + t1.getName() + "\tDepartment: " + t1.getDept() + "\nTotal Salary: €" + t1.getSal() + "\tProvident Fund Availability: " + t1.pf + "\tTax Amount: €" + t1.tax());
}
} /*
/*
@author mahesh */ public class Employee {
String Name, Dept; double sal;
public void setName(String Name) { this.Name = Name; }
public void setDept(String Dept) { this.Dept = Dept; }
public void setSal(double sal) { this.sal = sal; }
public String getName() { return Name; }
public String getDept() { return Dept; }
public double getSal() { return sal; }
} /*
/*
@author mahesh */ public class PermanentEmployee extends Employee {
boolean pf = true;
double newsal() { sal = sal * 1.1; return sal; }
double tax() { double tax = sal .20; return tax; } } /
/*
@author mahesh */ public class TemporaryEmployee extends Employee {
boolean pf = false;
double tax() { double tax = sal * .15; return tax; }
}
# Project: EmployeeImplementation package employeeimplementation;
/*
@author User */ public class EmployeeImplementation {
/**
@param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here PermanentEmp p = new PermanentEmp(); p.setName("Alice"); p.setPf(true); p.setDept("Computer"); p.setInc(0.1f); p.setTax(0.2f); p.setSalary(35000);
System.out.println("Name=" + p.getName()); System.out.println("Provident Fund=" + p.isPf()); System.out.println("Department=" + p.getDept()); System.out.println("Increment Value=" + p.getInc()); System.out.println("Tax=" + p.getTax()); System.out.println("Salary=Rs" + (p.getSalary() + (p.getSalary() p.getInc()) - (p.getSalary() p.getTax()))); System.out.println(" ");
TemporaryEmp t = new TemporaryEmp(); t.setName("Bob"); t.setPf(false); t.setDept("Computer"); t.setTax(0.15f); t.setSalary(35000);
System.out.println("Name=" + t.getName()); System.out.println("Provident Fund=" + t.isPf()); System.out.println("Department=" + t.getDept()); System.out.println("Tax=" + t.getTax()); System.out.println("Salary=Rs" + (t.getSalary() - (t.getSalary() * t.getTax()))); } }
# Class:Employee public class Employee {
float salary;
private String dept;
private String name;
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
# Class:PermanentEmp public class PermanentEmp extends Employee {
private boolean pf;
private float inc;
private float tax;
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
public float getInc() {
return inc;
}
public void setInc(float inc) {
this.inc = inc;
}
public float getTax() {
return tax;
}
public void setTax(float tax) {
this.tax = tax;
}
} # Class:TemporaryEmp public class TemporaryEmp extends Employee {
private boolean pf;
private float tax;
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
public float getTax() {
return tax;
}
public void setTax(float tax) {
this.tax = tax;
}
} Output:
/*
/*
@author dell */ public class InheritanceTaskEMployee {
/**
@param args the command line arguments */ public static void main(String[] args) {
// TODO code application logic here PermanemtEmployee E1 = new PermanemtEmployee(); E1.setName("Sanima"); E1.setDept("Manager"); E1.setPf(true); E1.setSalary(35000); System.out.println("Name of Permanent Employee:" + E1.getName()); System.out.println("Department: " + E1.getDept()); System.out.println("Pf: " + E1.isPf()); System.out.println("Salary :" + E1.getSalary()); System.out.println("tax :" + E1.getTax());
// temporary employee TemporaryEmployee E2 = new TemporaryEmployee(); E2.setName("Syslin"); E2.setDept("Computer"); E2.setPf(false); E2.setSalary(5000); System.out.println("Name of Temporary Employee:" + E2.getName()); System.out.println("Department: " + E2.getDept()); System.out.println("Pf: " + E2.isPf()); System.out.println("Salary :" + E2.getSalary()); System.out.println("tax :" + E2.getTax());
}
} /*
/*
@author dell */ public class EmployeeDetails {
private String name; private String dept; float Salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDept() { return dept; }
public void setDept(String dept) { this.dept = dept; }
public float getSalary() { return Salary; }
public void setSalary(float Salary) { this.Salary = Salary; }
} /*
/*
@author dell */ public class PermanemtEmployee extends EmployeeDetails {
private boolean pf = true; private float Salary; private float tax;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getSalary() { return Salary = (float) (Salary + (Salary * 0.1)); }
public void setSalary(float Salary) { this.Salary = Salary; }
public float getTax() { return tax = (float) (Salary * 0.2); }
public void setTax(float tax) { this.tax = tax; }
} /*
/*
@author dell */ public class TemporaryEmployee extends EmployeeDetails {
private boolean pf = false; private float tax;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getTax() { return tax = (float) (Salary * 0.15); }
public void setTax(float tax) { this.tax = tax; }
}
/*
/*
@author dragon15423 */ public class Day11Task {
/**
@param args the command line arguments / public static void main(String[] args) { // TODO code application logic here PermanentEmployee n = new PermanentEmployee(); n.setName("ganesh"); n.setSalary(35000); System.out.println("Name of employee: " + n.getName()); float a = n.getSalary() (1 + n.getSalary1()), b = a * n.getTax(); System.out.println("Salary: " + a); System.out.println("Salary after tax: " + (a - b)); System.out.println();
TemporaryEmployee n1 = new TemporaryEmployee(); n1.setName("ravi"); n1.setSalary(35000); System.out.println("Name of employee: " + n1.getName()); System.out.println("Salary after tax: " + n.getSalary() * (1 - n1.getTax())); System.out.println(); }
}
/*
/*
@author dragon15423 */ public class Employee {
private String name; private String department; private float salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
public float getSalary() { return salary; }
public void setSalary(int salary) { this.salary = salary; }
}
/*
/*
@author dragon15423 */ public class PermanentEmployee extends Employee {
private boolean pf = true; private float salary1 = 0.1f; private float tax = 0.2f;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getSalary1() { return salary1; }
public void setSalary1(int salary1) { this.salary1 = salary1; }
public float getTax() { return tax; }
public void setTax(int tax) { this.tax = tax; }
}
/*
/*
@author dragon15423 */ public class TemporaryEmployee extends Employee {
private boolean pf = false; private float tax = 0.15f;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getTax() { return tax; }
public void setTax(int tax) { this.tax = tax; }
}
package day11task3;
/*
@author DELL */ public class Day11Task3 {
/**
public static void main(String[] args) { // TODO code application logic here double ptotal, ttotal; ParmanentEmployee p = new ParmanentEmployee(); p.setName("Ramesh"); p.setSalary(35000); p.setDept("Manager"); ptotal = p.getSalary() * (1 + p.getSal() - p.getTax()); System.out.println("Name:" + p.getName() + "\nDept:" + p.getDept() + "\nTotal salary:" + ptotal); pfund(p.isPf());
TemproraryEmployee t = new TemproraryEmployee();
t.setName("Suresh");
t.setSalary(35000);
t.setDept("Assistant");
ttotal = t.getSalary() * (1 - t.getTax());
System.out.println("Name:" + t.getName() + "\nDept:" + t.getDept() + "\nTotal salary:" + ttotal);
pfund(t.isPf());
}
}
public class Emloyee {
private String name;
private String dept;
private float salary;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
}
public class ParmanentEmployee extends Emloyee {
private boolean pf = true;
private float sal = 0.1f;
private float tax = 0.2f;
public float getSal() {
return sal;
}
public void setSal(float sal) {
this.sal = sal;
}
public float getTax() {
return tax;
}
public void setTax(float tax) {
this.tax = tax;
}
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
}
public class TemproraryEmployee extends Emloyee {
private boolean pf = false;
private float tax = 0.15f;
public float getTax() {
return tax;
}
public void setTax(float tax) {
this.tax = tax;
}
public Boolean getPf() {
return pf;
}
public void setPf(Boolean pf) {
this.pf = pf;
}
public boolean isPf() {
return pf;
}
public void setPf(boolean pf) {
this.pf = pf;
}
}
/*
/*
@author admin */ public class EmployeeImplementation1 {
/**
@param args the command line arguments */ public static void main(String[] args) { PermanentEmployee e = new PermanentEmployee(); e.setName("Anu"); e.setSalary(35000); e.setDepartment("Computer"); e.setPf(true); e.setSal(0.1); e.setTax(0.2);
double SalInc = (e.getSal() e.getSalary()); double TaxAdd = (e.getTax() SalInc); double total = (e.getSalary() + SalInc - TaxAdd);
System.out.println("Permanent Employees:"); System.out.println("Name:" + e.getName()); System.out.println("Department:" + e.getDepartment()); System.out.println("Pf:" + e.getPf()); System.out.println("Salary:" + e.getSalary()); System.out.println("Incremented Salary:" + SalInc); System.out.println("Tax :" + TaxAdd); System.out.println("Total Salary:" + total);
TemporaryEmployee emp = new TemporaryEmployee();
emp.setName("Ram"); emp.setSalary(35000); emp.setDepartment("Computer"); emp.setPf(false); emp.setTax(0.15);
double TotalTemp = (emp.getSalary() - emp.getTax() * emp.getSalary()); System.out.println(""); System.out.println("Temporary Employee:"); System.out.println("Name:" + emp.getName()); System.out.println("Department:" + emp.getDepartment()); System.out.println("Pf:" + emp.getPf()); System.out.println(" Salary:" + emp.getSalary()); System.out.println("Total Salary:" + TotalTemp);
}
} /*
/*
@author admin */ public class Employee {
private String name; private String Department; private double salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDepartment() { return Department; }
public void setDepartment(String Department) { this.Department = Department; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; }
} /*
/*
@author admin */ public class PermanentEmployee extends Employee {
private Boolean Pf = true; private double salary; private double Sal; private double tax;
public Boolean getPf() { return Pf; }
public void setPf(Boolean Pf) { this.Pf = Pf; }
public double getSalary() { return salary; }
public void setSalary(int salary) { this.salary = salary; }
public double getSal() { return Sal; }
public void setSal(double Sal) { this.Sal = Sal; }
public double getTax() { return tax; }
public void setTax(double tax) { this.tax = tax; }
} /*
/*
@author admin */ public class TemporaryEmployee extends Employee {
private Boolean Pf = false; private double tax;
public Boolean getPf() { return Pf; }
public void setPf(Boolean Pf) { this.Pf = Pf; }
public double getTax() { return tax; }
public void setTax(double tax) { this.tax = tax; }
}
/*
/*
@author LORDsajan */ public class Employee {
private String name; private String dept; private double salary;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDept() { return dept; }
public void setDept(String dept) { this.dept = dept; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; } }
Class PermanentEmployee /*
/*
@author LORDsajan */ public class PermanentEmployee extends Employee {
private boolean pf = true; private float sal = 0.1f; private float tax = 0.2f;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getSal() { return sal; }
public void setSal(float sal) { this.sal = sal; }
public float getTax() { return tax; }
public void setTax(float tax) { this.tax = tax; }
}
Class TemporaryEmployee /*
/*
@author LORDsajan */ public class TemporaryEmployee extends Employee {
private boolean pf = false; private float tax = 0.15f;
public boolean isPf() { return pf; }
public void setPf(boolean pf) { this.pf = pf; }
public float getTax() { return tax; }
public void setTax(float tax) { this.tax = tax; } }
Employee
PermanentEmployee extends Employee
TemporaryEmployee extends Employee no pf tax - 15%