banking
Class SimpleAccountImpl

java.lang.Object
  extended bybanking.SimpleAccountImpl
All Implemented Interfaces:
Account

public class SimpleAccountImpl
extends java.lang.Object
implements Account

A simple banking SimpleAccountImpl class.

Version:
1.0 - 13/01/2004
Author:
Sara Bouchenak

Field Summary
private  float accountBalance
          The account balance.
private  int accountNumber
          The account number.
 
Constructor Summary
SimpleAccountImpl(int number, float balance)
          Constructs an SimpleAccountImpl with the specified number.
 
Method Summary
 void credit(float amount)
          Adds an amount to the current balance of this account.
 void debit(float amount)
          Deducts an amount from the current balance of this account.
 int getAccountNumber()
          Returns the number of this account.
 float getBalance()
          Returns the current balance of this account.
 void setBalance(float amount)
          Sets the balance of this account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accountNumber

private int accountNumber
The account number.


accountBalance

private float accountBalance
The account balance.

Constructor Detail

SimpleAccountImpl

public SimpleAccountImpl(int number,
                         float balance)
Constructs an SimpleAccountImpl with the specified number.

Parameters:
number - The account number
balance - The initial balance
Method Detail

getAccountNumber

public int getAccountNumber()
Returns the number of this account.

Specified by:
getAccountNumber in interface Account
Returns:
The account number.

getBalance

public float getBalance()
                 throws AccountException
Returns the current balance of this account.

Specified by:
getBalance in interface Account
Returns:
The account balance.
Throws:
AccountException - If a problem occurs during this operation, e.g., a problem to access the underlying database if any.

setBalance

public void setBalance(float amount)
                throws AccountException
Sets the balance of this account.

Specified by:
setBalance in interface Account
Parameters:
amount - The balance to be set
Throws:
AccountException - If a problem occurs during this operation, e.g., a problem when updating the underlying database if any.

credit

public void credit(float amount)
            throws AccountException
Adds an amount to the current balance of this account.

Specified by:
credit in interface Account
Parameters:
amount - The amount to add.
Throws:
AccountException - If a problem occurs during this operation, e.g., a problem when accessing/updating the underlying database if any.

debit

public void debit(float amount)
           throws AccountException
Deducts an amount from the current balance of this account.

Specified by:
debit in interface Account
Parameters:
amount - The amount to be deducted.
Throws:
AccountException - In case the amount to deduct is greater than the current balance, or if a problem occurs when querying/updating the underlying database if any.


University Grenoble 1 (France) - Department of Computer Science
Master M1 - Adaptable Middleware - AOP / AspectJ.