Class KontoC
java.lang.Object
KontoC
- All Implemented Interfaces:
- Konto
public class KontoC
- extends java.lang.Object
- implements Konto
Konto version C.
Uses java.util.concurrent mutexes to synchronize and coordinate.
Implements methods to display, add and remove money from the account,
account cannot become negative.
- Author:
- Heinz Kredel.
Field Summary |
protected java.util.concurrent.locks.Condition |
imPlus
|
protected java.util.concurrent.locks.Lock |
mutex
|
protected double |
stand
|
Method Summary |
double |
getGeld(double b)
New account balance gets calculated and returned. |
double |
putGeld(double b)
Transfers amount to this account. |
double |
zeigeGeld()
Displays account balance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stand
protected double stand
mutex
protected final java.util.concurrent.locks.Lock mutex
imPlus
protected final java.util.concurrent.locks.Condition imPlus
KontoC
public KontoC()
KontoC
public KontoC(double a)
zeigeGeld
public double zeigeGeld()
- Displays account balance.
- Specified by:
zeigeGeld
in interface Konto
- Returns:
- stand.
putGeld
public double putGeld(double b)
- Transfers amount to this account.
Blocks if account would become negative.
- Specified by:
putGeld
in interface Konto
- Parameters:
b
- amount to put on account.
- Returns:
- s returns actual balance from account.
getGeld
public double getGeld(double b)
- New account balance gets calculated and returned.
Blocks if account would become negative.
- Specified by:
getGeld
in interface Konto
- Parameters:
b
- amount to remove from desired account.
- Returns:
- s current account balance.