public class CommissionEmployeeTest
1: // Fig. 9.5: CommissionEmployeeTest.java
2: // Testing class CommissionEmployee.
3:
4: public class CommissionEmployeeTest
5: {
6: public static void main( String args[] )
7: {
8: // instantiate CommissionEmployee object
9: CommissionEmployee employee = new CommissionEmployee(
10: "Sue", "Jones", "222-22-2222", 10000, .06 );
11:
12: // get commission employee data
13: System.out.println(
14: "Employee information obtained by get methods: \n" );
15: System.out.printf( "%s %s\n", "First name is",
16: employee.getFirstName() );
17: System.out.printf( "%s %s\n", "Last name is",
18: employee.getLastName() );
19: System.out.printf( "%s %s\n", "Social security number is",
20: employee.getSocialSecurityNumber() );
21: System.out.printf( "%s %.2f\n", "Gross sales is",
22: employee.getGrossSales() );
23: System.out.printf( "%s %.2f\n", "Commission rate is",
24: employee.getCommissionRate() );
25:
26: employee.setGrossSales( 500 ); // set gross sales
27: employee.setCommissionRate( .1 ); // set commission rate
28:
29: System.out.printf( "\n%s:\n\n%s\n",
30: "Updated employee information obtained by toString", employee );
31: } // end main
32: } // end class CommissionEmployeeTest
33:
34:
35: /**************************************************************************
36: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
37: * Pearson Education, Inc. All Rights Reserved. *
38: * *
39: * DISCLAIMER: The authors and publisher of this book have used their *
40: * best efforts in preparing the book. These efforts include the *
41: * development, research, and testing of the theories and programs *
42: * to determine their effectiveness. The authors and publisher make *
43: * no warranty of any kind, expressed or implied, with regard to these *
44: * programs or to the documentation contained in these books. The authors *
45: * and publisher shall not be liable in any event for incidental or *
46: * consequential damages in connection with, or arising out of, the *
47: * furnishing, performance, or use of these programs. *
48: *************************************************************************/