forked from phongus/Deitel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* Fig. 17.4: SequentialFile.AccountRecord.java | ||
* SequentialFile.AccountRecord class maintains information for one account. | ||
*/ | ||
|
||
public class AccountRecord | ||
{ | ||
private int account; | ||
private String firstName; | ||
private String lastName; | ||
private double balance; | ||
|
||
// no-argument constructor calls other constructor with default values | ||
public AccountRecord() | ||
{ | ||
this(0, "", "", 0.0); // call four-argument contsructor | ||
} | ||
|
||
// initialize a record | ||
public AccountRecord(int acct, String first, String last, double bal) | ||
{ | ||
setAccount(acct); | ||
setFirstName(first); | ||
setLastName(last); | ||
setBalance(bal); | ||
} // end four-argument SequentialFile.AccountRecord constructor | ||
|
||
// set account number | ||
public void setAccount(int acct) | ||
{ | ||
account = acct; | ||
} // end method setAccount | ||
|
||
// get account number | ||
public int getAccount() | ||
{ | ||
return account; | ||
} // end method getAccount | ||
|
||
// set first name | ||
public void setFirstName(String first) | ||
{ | ||
firstName = first; | ||
} // end method setFirstName | ||
|
||
// get first name | ||
public String getFirstName() | ||
{ | ||
return firstName; | ||
} // end method getFirstName | ||
|
||
// set last name | ||
public void setLastName(String last) | ||
{ | ||
lastName = last; | ||
} // end method setLastName | ||
|
||
// get last name | ||
public String getLastName() | ||
{ | ||
return lastName; | ||
} // end method getLastName | ||
|
||
// set balance | ||
public void setBalance(double bal) | ||
{ | ||
balance = bal; | ||
} // end method setBalance | ||
|
||
// get balance | ||
public double getBalance() | ||
{ | ||
return balance; | ||
} // end method getBalance | ||
} // end class SequentialFile.AccountRecord |