rahajengdwp

Untitled

Mar 6th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //8.8 Employee.java
  2. //Employee class with references to other objects.
  3.  
  4. public class Employee
  5. {
  6. private String firstName;
  7. private String lastName;
  8. private Date birthDate;
  9. private Date hireDate;
  10.  
  11. //constructor to initialize name, birth date and hire date
  12. public Employee (String first, String last, Date dateOfBirth, 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", lastName, firstName, hireDate, birthDate);
  24. } //end method toString
  25. } //end class Employee
Advertisement
Add Comment
Please, Sign In to add comment