BenitoDannes

Untitled

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