glennluc

8.8

Mar 6th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // Employee class with references to other objects
  2.  
  3. public class Employee
  4. {
  5. private String firstName;
  6. private String lastName;
  7. private Date birthDate;
  8. private Date hireDate;
  9.  
  10. // constructor to initialize name, birth date and hire date
  11. public Employee( String first, String last, Date dateofBirth,
  12. Date dateofHire )
  13. {
  14. firstName = first;
  15. lastName = last;
  16. birthDate = dateofBirth;
  17. hireDate = dateofHire;
  18. }// end Employee constructor
  19.  
  20. //convert Employee to String format
  21. public String toString()
  22. {
  23. return String.format( "%s, %s Hired: %s Birthday: %s",
  24. lastName, firstName, hireDate, birthDate );
  25. }// end method toString
  26. }// end class Employee
Advertisement
Add Comment
Please, Sign In to add comment