Customer Bank
+------------------------------------+ +-------------------+
| + Customer | | + Bank |
+------------------------------------+ +-------------------+
| -accountNo : int | | |
| -balance : double | 0..* 1 +-------------------+
| -name : String |---------------| +main() : void |
| -count : int | +-------------------+
+------------------------------------+ :
| +Customer() | :
| +Customer(String, int, double) | +---------------+----------------+
| +getName() : String | | Create several customers using |
| +setName(String) : void | | both the default constructor |
| +getAccountNo() : int | | and overloaded constructors. |
| +setAccountNo(int) : void | | Objects created with the |
| +getBalance() : double | | default constructor, will |
| +setBalance(double) : void | | require subsequent "set" |
| +getCount() : int | | methods to initialise the |
| +toString() : String | | object state. |
+------------------------------------+ | Ensure that your customer |
: | count is accurate. |
: | Check that the set, get and |
+----------------+-----------------+ | toString() methods work as |
| toString() should return details | | expected. |
| of the object state | +--------------------------------+
+----------------------------------+
Console Output:
Customer [accountNo=123, name=James, balance=1000.0]
Customer [accountNo=345, name=Kate, balance=2000.0]
Customer [accountNo=567, name=Katy, balance=2500.0]
2