Code quản lý nhân sự bằng java-hướng đối tượng
CODE cho các bạn tham khảo nhé
import java.io.*;
import java.util.*;
//www.kenhdaihoc.com
public class QUANLYNHANSU {
public String HT;
public String NS;
public String DC;
public QUANLYNHANSU() {
}
public QUANLYNHANSU(String HT,String NS,String DChi ){
this.HT=HT;
this.NS=NS;
this.DC=DChi;
}
public void input(){
Scanner sc=new Scanner(System.in);
System.out.print("moi nhap hoten");
HT= sc.nextLine();
System.out.print("moi ban nhap ngay sinh");
NS=sc.nextLine();
System.out.print("moi ban nhap dia chi đia chi");
DC=sc.nextLine();
}
public void hienthi(){
System.out.println("ho ten nhan vien",+HT);
System.out.println("ngày sinh nhân viên",+NS);
System.out.println("dia ch? nhân viên",+DC);
}
public abstract double TinhLuong();
}
class NVSX extends QUANLYNHANSU{
public String soSP;
public NVSX()
{
super();
}
public NVSX(String HT,String NS,String DC, String soSP)
{
super(HT,NS,DC,soSP);
}
public double TinhLuong()
{
return soSP*20000;
}
public void input(){
Scanner sc=new Scanner(System.in);
soSP=sc.nextInt();
}
public hienthi()
{
{
super.hienthi();
}
System.out.println("luong cua nhân viên s?n xu?t là",+TinhLuong());
}
}
class NVCN extends QUANLYNHANSU{
public String soNC;
public NVCN(){
super();
}
public NVCN(String HT,String NS,String DC,String soNC){
super(HT,NS,DC,soNC);
}
public double TinhLuong(){
return soNC*90000;
}
public void input(){
Scanner sc=new Scanner(System.in);
System.out.print("moi ban nhap so ngay cong");
soNC=sc.nextLine();
}
public void hienthi(){
super.hienthi();
}
{
System.out.println("tien luong cua nhan vien cong nhat",+TienLuong());
}
}
class NVQL extends QUANLYNHANSU{
public String hsl;
public String lcb;
public NVQL(){
super();
}
public NVQL(String HT,String NS,String DC,String hsl,String lcb)
{
super(HT,NS,DC,hsl,lcb);
}
public double TinhLuong(String hsl,String lcb)
{
return hsl*lcb;
}
public void input(){
Scanner sc=new Scanner();
System.out.println("moi nhap he so luong");
sc.nextLine();
System.out.println("moi ban nhap luong co ban");
sc.nextLine();
}
public void hienthi(){
super.hienthi();
System.out.println("luong cua nhan vien quan ly",+TinhLuong());
}
}
//class xuly{
public static void main(String[] args) {
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextLine();
QUANLYNHANSU[] nv=new QUANLYNHANSU[n];
for(int i=0;i<n;i++)
{
nv[i]=new QUANLYNHANSU();
nv[i].input();
}
for(int i=0;i<n;i++)
{
nv[i].hienthi();
}
NVCN[] cn=new NVCN[n];
for(int i=0;i<n;i++)
{
cn[i]=new NVCN();
cn[i].input();
}
for(int i=0;i<n;i++)
{
cn[i].hienthi();
}
NVSX[] sx=new NVSX[n];
for(int i=0;i<n;i++)
{
sx[i]=new NVSX();
sx[i].input();
}
for(int i=0;i<n;i++)
{
sx[i].hienthi();
}
NVQL[] ql=new NVQL[n];
for(int i=0;i<n;i++)
{
ql[i]=new NVQL();
ql[i].input();
}
for(int i=0;i<n;i++)
{
ql[i].hienthi();
}
}
import java.io.*;
import java.util.*;
//www.kenhdaihoc.com
public class QUANLYNHANSU {
public String HT;
public String NS;
public String DC;
public QUANLYNHANSU() {
}
public QUANLYNHANSU(String HT,String NS,String DChi ){
this.HT=HT;
this.NS=NS;
this.DC=DChi;
}
public void input(){
Scanner sc=new Scanner(System.in);
System.out.print("moi nhap hoten");
HT= sc.nextLine();
System.out.print("moi ban nhap ngay sinh");
NS=sc.nextLine();
System.out.print("moi ban nhap dia chi đia chi");
DC=sc.nextLine();
}
public void hienthi(){
System.out.println("ho ten nhan vien",+HT);
System.out.println("ngày sinh nhân viên",+NS);
System.out.println("dia ch? nhân viên",+DC);
}
public abstract double TinhLuong();
}
class NVSX extends QUANLYNHANSU{
public String soSP;
public NVSX()
{
super();
}
public NVSX(String HT,String NS,String DC, String soSP)
{
super(HT,NS,DC,soSP);
}
public double TinhLuong()
{
return soSP*20000;
}
public void input(){
Scanner sc=new Scanner(System.in);
soSP=sc.nextInt();
}
public hienthi()
{
{
super.hienthi();
}
System.out.println("luong cua nhân viên s?n xu?t là",+TinhLuong());
}
}
class NVCN extends QUANLYNHANSU{
public String soNC;
public NVCN(){
super();
}
public NVCN(String HT,String NS,String DC,String soNC){
super(HT,NS,DC,soNC);
}
public double TinhLuong(){
return soNC*90000;
}
public void input(){
Scanner sc=new Scanner(System.in);
System.out.print("moi ban nhap so ngay cong");
soNC=sc.nextLine();
}
public void hienthi(){
super.hienthi();
}
{
System.out.println("tien luong cua nhan vien cong nhat",+TienLuong());
}
}
class NVQL extends QUANLYNHANSU{
public String hsl;
public String lcb;
public NVQL(){
super();
}
public NVQL(String HT,String NS,String DC,String hsl,String lcb)
{
super(HT,NS,DC,hsl,lcb);
}
public double TinhLuong(String hsl,String lcb)
{
return hsl*lcb;
}
public void input(){
Scanner sc=new Scanner();
System.out.println("moi nhap he so luong");
sc.nextLine();
System.out.println("moi ban nhap luong co ban");
sc.nextLine();
}
public void hienthi(){
super.hienthi();
System.out.println("luong cua nhan vien quan ly",+TinhLuong());
}
}
//class xuly{
public static void main(String[] args) {
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextLine();
QUANLYNHANSU[] nv=new QUANLYNHANSU[n];
for(int i=0;i<n;i++)
{
nv[i]=new QUANLYNHANSU();
nv[i].input();
}
for(int i=0;i<n;i++)
{
nv[i].hienthi();
}
NVCN[] cn=new NVCN[n];
for(int i=0;i<n;i++)
{
cn[i]=new NVCN();
cn[i].input();
}
for(int i=0;i<n;i++)
{
cn[i].hienthi();
}
NVSX[] sx=new NVSX[n];
for(int i=0;i<n;i++)
{
sx[i]=new NVSX();
sx[i].input();
}
for(int i=0;i<n;i++)
{
sx[i].hienthi();
}
NVQL[] ql=new NVQL[n];
for(int i=0;i<n;i++)
{
ql[i]=new NVQL();
ql[i].input();
}
for(int i=0;i<n;i++)
{
ql[i].hienthi();
}
}
Comments
Post a Comment