Assignment: Current Account

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Assignment

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>

a. A current account for customer Fred Clinton


b. A current account for customer Brok Monday with an overdraft limit of $200
c. A savings account for customer Wilma Fredstone
d. An investment account for customer Tod Esra [25]

Question 2

The bank wishes to perform the following operations on customer accounts

• Print an account value in the format previously specified


• Deposit an amount into an account
• Withdraw an amount from an account
• Change the overdraft limit on a current account
• Change the current account deposit service fee
• Change the current account withdrawal service fee
• Change the savings account withdrawal service fee
• Close an account(the account balance, whether in credit or debit is transferred to the bank’s
own account )
• Apply interest rate to the current balance of an account (you may assume that this will only
be done at the end of the month)

2.1 Implement these operations as methods in appropriate classes.

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:

a. open current account for Fred Flintstone


b. open a savings account for Barney Rubble
c. open an investment account for Wilma Flintstone
d. deposit $2000 in Fred Flintstone’s current account
e. deposit $3000 in Barney Rubble’s savings account
f. deposit $5000 in Wilma Flintstone’s investment account
g. withdraw $400 from Fred Flintstone’s current account
h. deposit $800 in Fred Flintstone’s current account
i. apply interest to Fred Flintstone’s current account
j. withdraw $2300 from Fred Flintstone’s current account
k. close Fred Flintstone’s current account
l. print the bank’s current account value
m. withdraw $2000 from Barney Rubble’s savings account
Page 2 of 3
n. apply interest to Barney Rubble’s savings account
o. withdraw $ 900 from Barney Rubble
p. close Barney Rubble’s savings account
q. print the bank’s own current account value
r. deposit $200 in Wilma Flintstone’s investment account
s. withdraw $600 from Wilma Flintstone’s investment account
t. print the bank’s own current account value

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.

Invalid transactions must be silently ignored. [15]

re than two loops.

Page 3 of 3

You might also like