ErSKS / Java

Java Training
http://khec.edu.np/
MIT License
16 stars 17 forks source link

Implement Java Inheritance - Employee #38

Closed ErSKS closed 7 years ago

ErSKS commented 7 years ago

Employee

PermanentEmployee extends Employee

TemporaryEmployee extends Employee no pf tax - 15%

kajalmaharjan commented 7 years ago

/*

/*

}

/*

/*

}

/*

/*

}

/*

/*

milan604 commented 7 years ago

package employeedetail;

/*

}

Class Employee

package employeedetail;

/*

Class Permanent Employee

package employeedetail;

/*

Class TemporaryEmployee package employeedetail;

/*

Output

screenshot from 2017-08-14 18-30-54

jagdish4249 commented 7 years ago

package task14august2;

/*

}

class Employee

package task14august2;

/*

}

class PermanentEmployee

package task14august2;

/*

class TemporaryEmployee

package task14august2;

/*

} capture

karmi214 commented 7 years ago

/*

/*

} /*

/*

/*

} /*

/*

ajay987 commented 7 years ago

/*

/*

}

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;
}

}

employee

RakenShahi commented 7 years ago

/*

/*

}

/*

/*

}

/*

/*

/*

/*

OUTPUT employee

maheshyakami commented 7 years ago

/*

import java.util.Scanner;

/*

} /*

/*

} /*

/*

/*

}

screen shot 2017-08-14 at 12 02 05 pm
ghost commented 7 years ago

# Project: EmployeeImplementation package employeeimplementation;

/*

# 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: emplo

syslin commented 7 years ago

/*

/*

} /*

/*

} /*

/*

} /*

/*

} e

Sudan15423 commented 7 years ago

/*

/*

}

Class Employee

/*

/*

}

Class PermanentEmployee

/*

/*

}

Class TemporaryEmployee

/*

/*

} day11task

rivab commented 7 years ago

package day11task3;

/*

}

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;
}

} day11task3

sthaanu commented 7 years ago

/*

/*

} /*

/*

} /*

/*

} /*

/*

} capture

sajanbasnet75 commented 7 years ago

/*

/*

Class PermanentEmployee /*

/*

}

Class TemporaryEmployee /*

/*