Question: java 1.a: Write an abstract Java class called Account to hold information about bank accounts. The Account class should contain suitable private instance variables to

java

java 1.a: Write an abstract Java class called Account to hold information

1.a: Write an abstract Java class called Account to hold information about bank accounts. The Account class should contain suitable private instance variables to represent the account number, the balance of the account, the name of the account holder and the address of the holder. It should also contain a List of transaction objects for that account. Provide a constructor method that enables an object of this class to be fully initialised when it is declared. Also provide other public methods to facilitate simple transactions on the account object and to retrieve the various account attributes (e.g. the balance, account holder details, transactions). Provide the implementation for a suitable class that contains details about past transactions. The Transaction class will need suitable private instance variables to represent the type of tansaction, the amount, the date / time, and the balance after the transaction was applied. You can use the java.util.Date class to represent the date /time within the Transaction class The list of transactions in the Account will be stored in the order the transactions were made 10 MARKS b: Write another Java class called SavingsAccount that inherits the Account class This derived class should contain an additional private instance variable called annuallnterestRate and an additional method called addMonthlyInterest that calculates the monthly interest and adds it to the account balance. The interest should be based on the closing balance each day for the past month. The closing balance can be obtained by iterating through the list of Transaction objects for the past month and then multiplying the closing account balance, as stored in the final Transaction object for each day, by annuallnterestRate and then divide this amount by 365; this daily interest should then be added to the account balance. Provide a suitable constructor method that enables an object of this class to be fully initialised when it is declared. You might find the following code sample useful in using and comparing date objects: Calendar cal -Calendar.getInstance ) cal.setTime (someDate) /someDate is a Date object int daycal.get (Calendar.DAY_OF_MONTH) 10 MARKS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!