/**
* represents a bank account
*
*/
public class Account
{
// the customer
private Customer customer;
// the account number
private String accountNumber;
// the account balance
private double balance;
// the maximum number of transactions
private final int MAX_TRANSACTIONS = 10;
// array to hold transactions
private Transaction[] transactions;
// the number of Transactions in the array
private int numberOfTransactions;
/**
* assigns values of instance variables
* @param customer is an object reference to the class Customer
* @param accountNumber is the customer's account number
*/
public Account(Customer customer, String accountNumber)
{
transactions = new Transaction[MAX_TRANSACTIONS];
numberOfTransactions = 0;
this.customer = customer;
this.accountNumber = accountNumber;
balance = 0.0f;
}
/**
* returns the account number
* @return accountNumber returns the account number
*/
public String getAccountNumber()
{
return accountNumber;
}
/**
* returns the customer name
* @return FirstName and LastName returns the customerName
*/
public String getCustomerName()
{
return (customer.getFirstName() + " " + customer.getLastName());
}
/**
* returns the account balance
* @return balance
*/
public double getBalance()
{
return balance;
}
/**
* returns the number of transactions
* @return numberOfTransactions
*/
public int getNumberOfTransactions()
{
return numberOfTransactions;
}
/**
* prints details of the account and its current transactions
*/
public void displayTransactions()
{
System.out.format("Account: %s\nCustomer: %s\n",
accountNumber,this.getCustomerName());
for(int i=0;i