A.) Create an abstract class named Account for a bank. Include an integer field for the account number and a double field for the account balance. Also include a constuctor that requires an account number and that sets the balance to 0.0. Include a set method for the balance. Also include two abstract get methods –one for each field. Creat two child classes of Account: Checking and Savings. Within Checking class, the get method displays the String “Checking Account Info”, the account number, and the balance. Within the Savings class, add a field to hold the interest rate, and require the Savings constructor to accept an arguementfor the value of the interest rate. The Savings get method displays the String “Savings Account Info”, the account number, the balance, and the interest rate. Write an application that demonstrates you can instantiate and display both Checking and Savings objects. Save the files as account.java, checking.java, savings.java, demoAccounts.java.

B.) Write an application named AccountArray in which you enter data for a mix of 10 checkingand savings accounts. Use a FOR loop to display the data. name it accountArray



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *