Create a class called
BankAccount. Have the data
members of the BankAccount be a String
representing an account name and a double representing an account
balance. Have the
constructor method take a String and double accordingly. The
class should also implement
the methods:
equals(BankAccount
other) that returns true if this bank account and the
other are the same.
getAccount()
that returns the bank account name of this account.
getBalance()
that returns the balance.
deposit(double
amount) that adds amount to the account balance.
withdraw(double
amount) that subtracts the amount from the account balance.
toString()
that returns a String that represents the account.
Remember to check for impossible activities, such as depositing a
negative amount or
withdrawing from an account with a negative balance.
I will test your BankAccount class with a
BankAccountTester.java
whose main
method
instantiates an account, deposits and withdraws and prints the
account. You should consider
writing your own to test as well.