BankAccount
toString
Add a toString
method to the BankAccount
class.
Your method should return a string that contains the account's name and balance separated by a comma and space.
For example, if an account object named benben
has the name "Benson"
and a balance of 17.25, benben.toString()
should return:
Benson, $17.25
If the client code were to call System.out.println(benben);
, that text would be shown on the console.
(Test your code by writing a short client program that constructs and initializes an account, then prints it.)