All pastes #374966 Raw Edit

Unnamed

public text v1 · immutable
#374966 ·published 2007-02-27 22:19 UTC
rendered paste body
/*
Pete Deremer
2/26/2007
CS111 - Assignment 2
Account.java
Description:
*/

public class Account {

	private static Customer customer;
	private static double balance;
	private static String accountNumber;
	private static Transaction[] transactions = new Transaction[100];

	/**
	Constructor
	*/
	public Account (Customer cust, double bal, String account, Transaction[] trans) {
		customer = cust;
		balance = bal;
		accountNumber = account;
		transactions = trans;
	}

	/**
	Returns the balance of the account
	*/
	public static double getBalance () {
		return balance;
	}

	/**
	Returns the customer information of the account holder
	*/
	public static Customer getCustomer () {
		return customer;
	}

	/**
	Returns a string statement containing the account information.
	*/
	public String toString () {
		return ("The Account " + this.accountNumber + " (" + getCustomer().getName() + ") has a balance of $" + getBalance() + ".");
	}
	
	/**
	Sets the new Customer
	*/
	public static void setCustomer (Customer newCustomer) {
		customer = newCustomer;
	}
}