Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A.) Create an abstract class named Account for a bank. Include an integer field

ID: 3649986 • Letter: A

Question

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

Explanation / Answer

Most of the solution is in the question. I won't do it all for you, but for (a): public abstract class Account { private int accountNumber; private double balance; public Account( int accNumber ) { accountNumber = accNumber; balance = 0.0; } public void setBalance( double newBalance ) { balance = newBalance; } public int getAccountNumber(); // the abstract get method for the account balance // how do you think you'd declare the get method for the balance? } public class Checking extends Account { public int getAccoutNumber() { System.out.println( "Checking Account Information" ); System.out.println( "" + accountNumber ); System.out.println( "" + balance ); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote