Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package quan.ly.nhan.vien;
- import java.util.Scanner;
- public class NhanVien
- {
- private String Ho, Ten;
- private int SoSP;
- Scanner sc = new Scanner(System.in);
- public NhanVien()
- {
- super();
- }
- public NhanVien(String Ho, String Ten, int SoSP)
- {
- super();
- this.Ho = Ho;
- this.Ten = Ten;
- this.SoSP = SoSP;
- }
- public String getHo()
- {
- return Ho;
- }
- public void setHo(String Ho)
- {
- this.Ho = Ho;
- }
- public String getTen(String Ten)
- {
- return Ten;
- }
- public void setTen()
- {
- this.Ten = Ten;
- }
- public String getSoSP(String SoSP)
- {
- return SoSP;
- }
- public void setSoSP()
- {
- this.SoSP = SoSP;
- }
- public void Nhap()
- {
- System.out.print("Nhập họ: ");
- Ho = sc.nextLine();
- System.out.print("Nhập Tên: ");
- Ten = sc.nextLine();
- System.out.print("Nhập số SP: ");
- SoSP = Integer.parseInt(sc.nextLine());
- }
- public void getLuong()
- {
- double DonGia = 0;
- if(SoSP >= 1 && SoSP <= 199)
- {
- DonGia = 0.5;
- }
- else if(SoSP >= 200 && SoSP <= 399)
- {
- DonGia = 0.55;
- }
- else if(SoSP >= 400 && SoSP <= 599)
- {
- DonGia = 0.6;
- }
- else
- {
- DonGia = 0.65;
- }
- double luong = SoSP * DonGia;
- System.out.println("Nhân viên " + Ho + " " + Ten + " có mức lương là: " + luong);
- }
- public static void main(String[] args)
- {
- NhanVien nv = new NhanVien();
- Scanner sca = new Scanner(System.in);
- System.out.print("Nhập số lượng nhân viên: ");
- int size = Integer.parseInt(sca.nextLine());
- for(int i = 0; i < size; i++)
- {
- nv.Nhap();
- }
- for(int i = 0; i < size; i++)
- {
- nv.getLuong();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement