ilminottaken

Untitled

Oct 5th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. // Fig. 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,
  13.         Date dateOfHire )
  14.         {
  15.             firstName = first;
  16.             lastName = last;
  17.             birthDate = dateOfBirth;
  18.             hireDate = dateOfHire;
  19.         } // end Employee constructor
  20.  
  21.     // convert Employee to String format
  22.     public String toString()
  23.     {
  24.         return String.format( "%s, %s Hired: %s Birthday: %s",
  25.         lastName, firstName, hireDate, birthDate );
  26.     } // end method toString
  27. } // end class Employee
Add Comment
Please, Sign In to add comment