416 Object-Based Programming Chapter 8 1 // Fig. (Apache web server for windows)
416 Object-Based Programming Chapter 8 1 // Fig. 8.14: Employee.java 2 // Definition of class Employee. 3 package com.deitel.jhtp4.ch08; 4 5 public class Employee extends Object { 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, 13 int birthMonth, int birthDay, int birthYear, 14 int hireMonth, int hireDay, int hireYear ) 15 { 16 firstName = first; 17 lastName = last; 18 birthDate = new Date( birthMonth, birthDay, birthYear ); 19 hireDate = new Date( hireMonth, hireDay, hireYear ); 20 } 21 22 // convert Employee to String format 23 public String toString() 24 { 25 return lastName + “, ” + firstName + 26 ” Hired: ” + hireDate.toString() + 27 ” Birthday: ” + birthDate.toString(); 28 } 29 30 } // end class Employee Fig. 8.14 Employeeclass with member object references. 1 // Fig. 8.15: EmployeeTest.java 2 // Demonstrating an object with a member object. 3 4 // Java extension packages 5 import javax.swing.JOptionPane; 6 7 // Deitel packages 8 import com.deitel.jhtp4.ch08.Employee; 9 10 public class EmployeeTest { 11 12 // test class Employee 13 public static void main( String args[] ) 14 { 15 Employee employee = new Employee( “Bob”, “Jones”, 16 7, 24, 49, 3, 12, 88 ); 17 Fig. 8.15 Demonstrating an object with a member object reference (part 1 of 2). Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services