se.kth.leiflindback.distdb.db
Class Account

java.lang.Object
  extended by se.kth.leiflindback.distdb.db.Account
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NullAccount

public class Account
extends java.lang.Object
implements java.io.Serializable

This is the distributed data. The actual data is the balance of this bank account.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
Account()
           
 
Method Summary
 void addInterest(float percentage)
          Deposits the interest to the account.
 void deposit(float amount)
          Deposit the specified amount.
 float getBalance()
          Returns the balance.
 void withdraw(float amount)
          Withdraw the specified amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Account

public Account()
Method Detail

getBalance

public float getBalance()
Returns the balance.

Returns:
the balance.

withdraw

public void withdraw(float amount)
Withdraw the specified amount. Withdrawal of an amount larger than the balance results in negative balance.

Parameters:
amount - The amount to withdraw.

deposit

public void deposit(float amount)
Deposit the specified amount.

Parameters:
amount - The amount to deposit.

addInterest

public void addInterest(float percentage)
Deposits the interest to the account. To deposit 3% interest the call should be addInterest(3).

Parameters:
percentage - The interest percentage.