public class AccountRecordSerializable implements Serializable
1: // Fig. 14.17: AccountRecordSerializable.java
2: // A class that represents one record of information.
3: package com.deitel.jhtp6.ch14; // packaged for reuse
4:
5: import java.io.Serializable;
6:
7: public class AccountRecordSerializable implements Serializable
8: {
9: private int account;
10: private String firstName;
11: private String lastName;
12: private double balance;
13:
14: // no-argument constructor calls other constructor with default values
15: public AccountRecordSerializable()
16: {
17: this( 0, "", "", 0.0 );
18: } // end no-argument AccountRecordSerializable constructor
19:
20: // four-argument constructor initializes a record
21: public AccountRecordSerializable(
22: int acct, String first, String last, double bal )
23: {
24: setAccount( acct );
25: setFirstName( first );
26: setLastName( last );
27: setBalance( bal );
28: } // end four-argument AccountRecordSerializable constructor
29:
30: // set account number
31: public void setAccount( int acct )
32: {
33: account = acct;
34: } // end method setAccount
35:
36: // get account number
37: public int getAccount()
38: {
39: return account;
40: } // end method getAccount
41:
42: // set first name
43: public void setFirstName( String first )
44: {
45: firstName = first;
46: } // end method setFirstName
47:
48: // get first name
49: public String getFirstName()
50: {
51: return firstName;
52: } // end method getFirstName
53:
54: // set last name
55: public void setLastName( String last )
56: {
57: lastName = last;
58: } // end method setLastName
59:
60: // get last name
61: public String getLastName()
62: {
63: return lastName;
64: } // end method getLastName
65:
66: // set balance
67: public void setBalance( double bal )
68: {
69: balance = bal;
70: } // end method setBalance
71:
72: // get balance
73: public double getBalance()
74: {
75: return balance;
76: } // end method getBalance
77: } // end class AccountRecordSerializable
78:
79: /*************************************************************************
80: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
81: * Pearson Education, Inc. All Rights Reserved. *
82: * *
83: * DISCLAIMER: The authors and publisher of this book have used their *
84: * best efforts in preparing the book. These efforts include the *
85: * development, research, and testing of the theories and programs *
86: * to determine their effectiveness. The authors and publisher make *
87: * no warranty of any kind, expressed or implied, with regard to these *
88: * programs or to the documentation contained in these books. The authors *
89: * and publisher shall not be liable in any event for incidental or *
90: * consequential damages in connection with, or arising out of, the *
91: * furnishing, performance, or use of these programs. *
92: *************************************************************************/