Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. package quan.ly.nhan.vien;
  2. import java.util.Scanner;
  3.  
  4. public class NhanVien
  5. {
  6.     private String Ho, Ten;
  7.     private int SoSP;
  8.     Scanner sc = new Scanner(System.in);
  9.    
  10.     public NhanVien()
  11.     {
  12.         super();
  13.     }
  14.    
  15.     public NhanVien(String Ho, String Ten, int SoSP)
  16.     {
  17.         super();
  18.         this.Ho = Ho;
  19.         this.Ten = Ten;
  20.         this.SoSP = SoSP;
  21.     }
  22.    
  23.     public String getHo()
  24.     {
  25.         return Ho;
  26.     }
  27.    
  28.     public void setHo(String Ho)
  29.     {
  30.         this.Ho = Ho;
  31.     }
  32.    
  33.     public String getTen(String Ten)
  34.     {
  35.         return Ten;
  36.     }
  37.    
  38.     public void setTen()
  39.     {
  40.         this.Ten = Ten;
  41.     }
  42.    
  43.     public String getSoSP(String SoSP)
  44.     {
  45.         return SoSP;
  46.     }
  47.    
  48.     public void setSoSP()
  49.     {
  50.         this.SoSP = SoSP;
  51.     }
  52.    
  53.     public void Nhap()
  54.     {
  55.         System.out.print("Nhập họ: ");
  56.         Ho = sc.nextLine();
  57.        
  58.         System.out.print("Nhập Tên: ");
  59.         Ten = sc.nextLine();
  60.        
  61.         System.out.print("Nhập số SP: ");
  62.         SoSP = Integer.parseInt(sc.nextLine());
  63.     }
  64.    
  65.     public void getLuong()
  66.     {
  67.         double DonGia = 0;
  68.        
  69.         if(SoSP >= 1 && SoSP <= 199)
  70.         {
  71.             DonGia = 0.5;
  72.         }
  73.        
  74.         else if(SoSP >= 200 && SoSP <= 399)
  75.         {
  76.             DonGia = 0.55;
  77.         }
  78.        
  79.         else if(SoSP >= 400 && SoSP <= 599)
  80.         {
  81.             DonGia = 0.6;
  82.         }
  83.        
  84.         else
  85.         {
  86.             DonGia = 0.65;
  87.         }
  88.        
  89.         double luong = SoSP * DonGia;
  90.        
  91.         System.out.println("Nhân viên " + Ho + " " + Ten + " có mức lương là: " + luong);
  92.     }
  93.  
  94.     public static void main(String[] args)
  95.     {
  96.         NhanVien nv = new NhanVien();
  97.         Scanner sca = new Scanner(System.in);
  98.        
  99.         System.out.print("Nhập số lượng nhân viên: ");
  100.         int size = Integer.parseInt(sca.nextLine());
  101.        
  102.         for(int i = 0; i < size; i++)
  103.         {
  104.             nv.Nhap();
  105.         }
  106.        
  107.         for(int i = 0; i < size; i++)
  108.         {
  109.             nv.getLuong();
  110.         }
  111.     }
  112.    
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement