Advertisement
arafaee

Employee.java

Apr 17th, 2017
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1.  
  2. /**
  3.  * 8.8 Employee.java
  4.  *
  5.  * @author Hafara Firdausi/ 5115100043
  6.  * @version 01
  7.  */
  8.  
  9. public class Employee
  10. {
  11.     private String firstName;
  12.     private String lastName;
  13.     private Date birthDate;
  14.     private Date hireDate;
  15.    
  16.     //constructor to initialize name, birth date and hire date
  17.     public Employee (String first, String last, Date dateOfBirth, Date dateOfHire)
  18.     {
  19.         firstName=first;
  20.         lastName=last;
  21.         birthDate=dateOfBirth;
  22.         hireDate=dateOfHire;
  23.     } //end Employee constructor
  24.    
  25.     //convert Employee to String format
  26.     public String toString()
  27.     {
  28.         return String.format("%s, %s Hired: %s Birthday: %s", lastName, firstName, hireDate, birthDate);
  29.     } //end method toString
  30. } //end class Employee
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement