Advertisement
binibiningtinamoran

Employee

Oct 23rd, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. public class Employee {
  2.  
  3.     private String firstName, lastName;
  4.     private boolean isPaid;
  5.     private int hours;
  6.  
  7.     public Employee(String firstName, String lastName, boolean isPaid, int hours) {
  8.         this.firstName = firstName;
  9.         this.lastName = lastName;
  10.         this.isPaid = isPaid;
  11.         this.hours = Math.max(hours, 0);
  12.     }
  13.  
  14.     public String getFirstName() {
  15.         return firstName;
  16.     }
  17.  
  18.     public void setFirstName(String firstNam) {
  19.         this.firstName = firstNam;
  20.     }
  21.  
  22.     public String getLastName() {
  23.         return lastName;
  24.     }
  25.  
  26.     public void setLastName(String lastName) {
  27.         this.lastName = lastName;
  28.     }
  29.  
  30.     public boolean isPaid() {
  31.         return isPaid;
  32.     }
  33.  
  34.     public int getHours() {
  35.         return hours;
  36.     }
  37.  
  38.     public void setHours(int hours) {
  39.         this.hours = hours;
  40.     }
  41.  
  42.     @Override
  43.     public String toString() {
  44.         return "Employee{" +
  45.                 "firstNam='" + firstName + '\'' +
  46.                 ", lastName='" + lastName + '\'' +
  47.                 ", isPaid=" + isPaid +
  48.                 ", hours=" + hours +
  49.                 '}';
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement