Details of this Paper

Write the java code for an abstract class about banking




Write the Java code for an abstract class named Account which has two data members, one for the account number and the other for the account balance (use information hiding). The Account class should include get and set methods for both data members and a constructor that initializes the two data members from the values received in the parameter list. Create (override) the toString() method that returns a string indicating the account number and the account balance. In addition to these methods, the Account class will have one abstract method called calculateInterest. The calculateInterest method will take one argument representing the interest rate and will return an amount representing the interest calculated based on the balance.;In addition to the Account superclass, write the code for two subclasses: CheckingAcct and SavingsAcct. The CheckingAcct interest is calculated only if the account balance is over 700 dollars. The checking account should also be able to tell the user if cosignatories are required or not with the default being not required. The SavingAcct interest is calculated on any balance greater than zero. The SavingsAcct constructor should initialize its only data member called accumulatedInterest to zero. Assume the interest calculation is for the year and the rate is 7%.;Write the code for a class named TestAccounts that will create an array of 3 Account references, instantiates two CheckingAcct objects and one SavingsAcct object, and then assigns the CheckingAcct objects to the first two array elements to the array mentioned above, and the SavingsAcct object to the third. Create a loop that calls the calculateInterest method and then displays the interest for all three accounts using the array references.


Paper#63962 | Written in 18-Jul-2015

Price : $22