Java Programming I need the answer asap, thank you! Note: The attached photo is the unfinished version, please complete it. thank you so much! Create an class 'Bank' with attributes name and balance....



Java Programming


I need the answer asap, thank you!



Note: The attached photo is the unfinished version, please complete it. thank you so much!




Create an class 'Bank'  with attributes name and balance.  Create two constructor: default constructor and a constructor that accepts all attribute. Provide getters and setters for class 'Bank'. The class has an  abstract method 'showDetails' with void as return type. Method 'showDetails' displays the name and balance of the account.



 'BankA' and  'BankB' ' are subclasses of class 'Bank'. Create two constructor in each classes:  default constructor; and constructor that accepts name and balance and call appropriate super constructor.




Code to be completed:

public abstract class Bank {
    private String name;
    private int balance;

    public Bank(){};
    public Bank(String name, int balance) {
        this.name = name;
        this.balance = balance;
    }

    // setters
    public void setName(String name) {
        this.name = name;
    }
    public void setBalance(int balance) {
        this.balance = balance;
    }

    //getters
    public String getName() {
        return name;
    }
    public int getBalance() {
        return balance;
    }

    public abstract void showDetails();
}


public abstract class Bank {<br>private String name;<br>private int balance;<br>public Bank(){};<br>public Bank(String name, int balance) {<br>this.name = name;<br>this.balance = balance;<br>}<br>// setters<br>public void setName (String name) {<br>this.name = name;<br>%3D<br>}<br>public void setBalance (int balance) {<br>this.balance = balance;<br>}<br>//getters<br>public String getName () {<br>return name;<br>}<br>public int getBalance() {<br>return balance;<br>}<br>

Extracted text: public abstract class Bank { private String name; private int balance; public Bank(){}; public Bank(String name, int balance) { this.name = name; this.balance = balance; } // setters public void setName (String name) { this.name = name; %3D } public void setBalance (int balance) { this.balance = balance; } //getters public String getName () { return name; } public int getBalance() { return balance; }
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here