I'm doing a simple school project but I'm stuck on something that's probably really simple.
The program is basically for a "bank owner" who has access to people's accounts and the ability to create multiple accounts.
All I need to do is allow the user to input the name of the account which they'd like to get information on
Assume I made a new account as follows:
static Account account01 = new Account( "Account 1" , 25.0 );
where "Account1" is the name of the account and "25.0" is the balance, in dollars.
Now I have the following code
System.out.println("Enter the name of the account that you want to print the balance of");
String nameInput = scan.nextLine();
nameInput.toString();
I want to run the toString method for account01 which prints the account balance, but how do I do that? I tried doing nameInput.toString(); but that just prints the name I typed in. I need to substitute nameInput with the name of the account entered.
Any help is appreciated.