Assignment 1: Bank Account Class
You are hired by a Canadian bank in order to develop a java application for processing withdraw
and deposit transactions. The application enables staff of the bank to create new bank accounts,
to process account transactions and to display the balance of a particular account.
Complete the following parts:
Part 1(6 marks): Draw the UML diagram for the Account class and then implement it.
The class contains:
A private int data field named id for the account (default 0)
A private double data field named balance for the account (default 0)
A private double data field named annualInterestRate that stores the current interest rate.
The annualInterestRate is the same for all accounts.
A no-argumentconstrutor that creates the defaults account
A constructor that creates an account with specified id and initial balance
The accessor ( getter) and mutator (setter) methods for the data fields: id, balance, and
A method named getMontheyIterest() that returns the monthly interest. The monthly
interest = balance * (annualInterestRate/1200)
A method named withdraw that withdraws a specified amount from the account
A method named deposit that deposits a specified amount to the account
Part 2( 4 marks): Develop TestAccount Calss that contains:
A main method that does the following:
o Define an array of three bank accounts
o Creates three bank accounts with the Ids 1,2, and 3 with zero balance
o Gets the annual interest rate which is the same for all accounts
o Gets the initial balance of the three accounts from the user
o Uses the setter methods of the account to set the balance and the interest rate for
the three accounts
o Deposit the amounts 1000, 2000, and 3000 to the three accounts respectively
o Withdraw the amounts 200,450 from accounts 1 and 2
o Prints out the balance of the three accounts