Skip to content

Commit

Permalink
Needed to add AccountRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
phongus committed Sep 6, 2015
1 parent 2836e9e commit 9e7e182
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions Exercise 17.2/src/AccountRecord.java
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

0 comments on commit 9e7e182

Please sign in to comment.