Banks offer various types of accounts, such as savings, checking. Each of these
ID: 3529535 • Letter: B
Question
Banks offer various types of accounts, such as savings, checking. Each of these accounts has various options. The figure shows the inheritance hierarchy of these bank accounts. Note that the class bankAccount is abstract. That is, we cannot instantiate objects of this class. The other classes are not abstract. bankAccount: Every bank account has an account number, the name of the owner, and a balance. Therefore, instance variables such as name, accountNumber, and balance should be declared in the abstract class bankAccount. Some operations common to all types of accounts are retrieve account ownerExplanation / Answer
/File Name :Account.java //Account class public abstract class Account { //data members int accountnumber; double accountbalance; //constructor public Account(int accn,double balance) { accountnumber = accn; accountbalance = balance; } //deposit method public void deposit(double amount) { accountbalance +=amount; System.out.println("$"+amount +" deposited into your account"); System.out.println("Your account balance is $"+accountbalance); } //withdraw method public void withdraw(double amount) { if(amount
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.