(+84) 236.3827111 ex. 402

Abstract class (tt)


public class NhanVienBienChe extends NhanVien {

private float HSL;

public NhanVienBienChe() {

}

public NhanVienBienChe(float HSL, String hoTen, String CMND, String phongBan, Date ngayVaoLam) {

super(hoTen, CMND, phongBan, ngayVaoLam);

this.HSL = HSL;

}

public float getHSL() {

return HSL;

}

public void setHSL(float HSL) {

this.HSL = HSL;

}

@Override

public float getLuong() {

return getPhuCap() + HSL * LUONG_CO_BAN;

}

@Override

public float getPhuCap() {

//Để lấy calendar sử dụng time zone và locale mặc định.

Calendar cal = Calendar.getInstance();

//Lấy năm hiện tại

int namHienTai = cal.get(Calendar.YEAR);

cal.setTime(ngayVaoLam);

int namVaoLam=cal.get(Calendar.YEAR);

return (namHienTai-namVaoLam)*200000;

}

}

public class NhanVienHopDong extends NhanVien {

private int tongGioLam, tienCongMotGio;

public NhanVienHopDong() {

}

public NhanVienHopDong(int tongGioLam, int tienCongMotGio, String hoTen, String CMND, String phongBan, Date ngayVaoLam) {

super(hoTen, CMND, phongBan, ngayVaoLam);

this.tongGioLam = tongGioLam;

this.tienCongMotGio = tienCongMotGio;

}

public int getTongGioLam() {

return tongGioLam;

}

public void setTongGioLam(int tongGioLam) {

this.tongGioLam = tongGioLam;

}

public int getTienCongMotGio() {

return tienCongMotGio;

}

public void setTienCongMotGio(int tienCongMotGio) {

this.tienCongMotGio = tienCongMotGio;

}

@Override

public float getPhuCap() {

if (tongGioLam > 170) {

return 200000;

} else if (tongGioLam < 80) {

return 0;

} else {

return 100000;

}

}

@Override

public float getLuong() {

return getPhuCap()+tongGioLam*tienCongMotGio;

}

}