public class BankAccount { //instance variables private double balance = 0.0; private double interestRate = 0.005; private String typeOfAccount ; private String customerName; private int accountId; private static int nextId; public BankAccount(String name) { this.customerName = name; this.interestRate = 0.005; this.typeOfAccount = "Chequing"; if (nextId <= 0) nextId = 100; this.accountId = nextId++; } public void deposit(double amount) { if (amount > 0.00) this.balance += amount; } public double getBalance() { return balance; } public double getInterestRate() { return interestRate; } public String getTypeOfAccount() { return typeOfAccount; } public int getAccountId() { return accountId; } public void setInterestRate(double interestRate) { this.interestRate = interestRate; } public void setTypeOfAccount(String typeOfAccount) { this.typeOfAccount = typeOfAccount; } public void withdraw(double amount) { if (amount <= this.balance && amount > 0.00) this.balance -= amount; } public String toString() { String str= String.format("%-4s " ,this.accountId); str += this.customerName; str += ": $"; str += String.format("%.2f", this.balance); return str; } }