Java Codingin This Section You Are Given A Piece Of Working Software That


JAVA Coding

In this section, you are given a piece of working software that

has 5 classes: the driver class TestLabVersion1, the Account class, the CheckingAccount, the SavingsAccount class, and the Bank class. Both the CheckingAccount and the SavingsAccount are children of Account. The Bank class contains different kinds of accounts.

In this lab, we assume that both CheckingAccount and SavinsAccount earn interest. The interest rate for checkingAccout is 0.05; the interest rate for SavingsAccount is 0.12. The getBalance() in the CheckingAccount will add 5% interest to the balance and return the total (do not change the balance in the parent class); the getBalance() in the SavingsAccount will add 12% interest to the balance and return the total (do not change the balance in the parent class). The class CheckingAccount and SavingsAccount are similar except the following two differences: 1) the interest rate is different. 2) the SavingsAccount has an extra method getTax() which returns the tax amount that is calculated according to the expression tax = balance * 0.01. The Bank class is the container that hosts different kinds of accounts. It has a method toString() that displays the content of accounts.

————————————————————————————–Account begin

public class Account


private double balance;

private String name;

public Account() {}

public Account(String name, double openBalance)

{ = name;

balance = openBalance;


public double getBalance()


return balance;


public String getName()


return name;



————————————————————————————–Account end

————————————————————————————–CheckingAccount begin

public class CheckingAccount extends Account


private final double INTERESTRATE = 0.05;