Académique Documents
Professionnel Documents
Culture Documents
The aim of this assignment is to write a simple program for a very small bank that has
only two customers. Each customer has two types of accounts – a Hong Kong dollars
saving account and a current account. Each type of account supports a Deposit and a
Withdraw operation. For example, a Deposit(10.5) will add HKD$10.5 to the account,
and Withdraw(6.5) will deduct HKD$6.5 from the account.
ii) Deposit $100 and $300 respectively into the saving and current account of
James Bond and $20000 and $50000 respectively into the saving and current
accounts of Goldfinger.
iv) Write a method that prints an account summary for all customers in the bank,
i.e. a summary that looks like this
Account holder: James Bond
Account ID: 7
Account type:
Saving account: $100
Current account: $300
v) OK, now here is the difficult part. Add a new USD account that is created
automatically for all account holders. There is no money in the account so the
balance is 0. Print the account summary as in step (iv).
Here are some issues for you to consider:
- What are the objects?
- Are there any objects that we can group together and to provide a more
generalized type?
- Could the more generalized type be used as base class and the more
specialized type be used as subtype?
- Who should have the responsibility in printing the balance of the current
account of James Bond?
- Find the simplest way in adding the new USD account and to print the
summary without affecting the rest of the system.