/* TestEmployee.java CIS 160 David Klick 2004-10-27 Employee class test driver */ public class TestEmployee { public static void main(String[] args) { // test constructors and toString method Employee e1 = new Employee(); System.out.println(e1); Employee e2 = new Employee("Rose Mary"); System.out.println(e2); Employee e3 = new Employee("Herb Provence", 12.50); System.out.println(e3); Employee e4 = new Employee("Tim Curry", 17.00, 42.00); System.out.println(e4); // test accessor methods System.out.println(e4.getName()); System.out.println(e4.getRate()); System.out.println(e4.getHours()); // test equals method System.out.println(e4.getGrossPay()); if (e3.equals(e4)) System.out.println("equals method broken"); // test mutator methods e3.setName(e4.getName()); e3.setHours(e4.getHours()); e3.setRate(e4.getRate()); // test equals method if (e3.equals(e4)) System.out.println("equals method seems to work"); else System.out.println("equals method broken"); // test copy constructor e2 = new Employee(e4); if (e2.equals(e4)) System.out.println("copy constructor seems to work"); else System.out.println("copy constructor is broken"); } } /* Sample run: , rate: 0.00, hours: 0.00 Rose Mary, rate: 0.00, hours: 0.00 Herb Provence, rate: 0.00, hours: 12.50 Tim Curry, rate: 17.00, hours: 42.00 Tim Curry 17.0 42.0 731.0 equals method seems to work copy constructor seems to work */