Professional Documents
Culture Documents
Assignment: Current Account
Assignment: Current Account
Assignment: Current Account
A small high-street commercial bank wishes to computerize their operations. You are required to
implement their system in Java.
The bank offers current, savings and investments accounts. Account information includes account
number (which is at least 5 digits) and customer name. The first 3 digits of each account number
represents the account type/category (ie current, savings or investments) while the rest of the digits
increment whenever a new account is created in each category. A ‘102’ represents current account
category while a ’103’ and ‘104’ are for savings and investment account respectively.
Current Account.
The first current account opened ends with 1000. Each current account has an overdraft limit. The
overdraft limit can be set when the account is opened; otherwise the default overdraft limit is zero. No
interest is paid on credit balances. Debit balances (overdrafts) are charged interest at 45% per annum.
You may assume that interest operations are only applied at the end of each month. No interest applies
in the period between the date of closing the account and the end of the previous month. Deposit
transactions are charged a service fee of $2.50 each. Withdrawal transactions are charged a service fee
of $5.00 each.
Savings Account.
The first savings account opened ends with 2000. Deposit transactions are free. Withdrawal transactions
are charged a service fee of $5.00 each. Savings accounts may not be overdrawn. Interest of 25% per
annum is paid on the current balance. You may assume that interest operations are only applied at the
end of each month. No interest applies in the period between the date of closing the account and the end
of the previous month.
Investment Account.
The first investment account opened ends with 3000. Deposit and withdrawal transactions are free.
Customers may make as many deposits as they wish but they may make only a single withdrawal
transaction after which the account is closed. Investment accounts may not be overdrawn. Interest of
35% per annum is paid on the current balance. You may assume that interest operations are only applied
at the end of each month. No interest applies in the period between the date of closing the account and
the end of the previous month.
Question 1
The bank requires Java classes and methods to model their customer accounts.
1.1 Give public classes named CurrentAccount, SavingsAccount and InvestmentAccount together with
whatever additional classes you need to implement bank accounts. Include all the instance fields
required to implement the required design, but include only only the minimum methods
required to implement the operations of the following main() method.
1.2 Give a public class AccountTest containing only a main() method which opens the following
accounts, in order. Immediately after a customer account has been opened you must print its
value to the console in the following format:
Page 1 of 3
Number 1234
Type: Current(or Savings or Investment, as applicable)
Name: Zanamwe Ngonidzashe
Balance: $1200.00
<Blank line>
Question 2
2.2 Give a public class AccountTest1 containing only the main() method which
implements the following transactions, in order and prints in the format previously
specified the value of each customer account to the console after each transaction:
Invalid transactions, such as attempting to withdraw an amount larger than the available balance must
be silently ignored. [30]
Question 3
The bank wishes to store all customer account information in a single ledger. Accounts are stored in the
ledger immediately after they are created, in the order in which they are created. Speed of operation is
irrelevant.
Provide appropriate public classes and methods to implement the ledger as an object of class ArrayList.
You will need to adjust the semantics of some operations described in question 2. For example, the
operation to close an account in question 2 becomes an operation to remove an account from the ledger.
Provide a method to print in the format previously specified the value of each customer account in the
ledger in the order in which they are stored.
Give a public class AccountTest3 containing only main() method which implements the transactions
given in question 2 in order (but do not print account values after each transaction), and print the
complete ledger to the console immediately after transactions c, f, j, k, p and t. The ledger is empty
when your program starts.
Page 3 of 3