Better, but it still needs a lot of work. Your check account.contains(name) won't work as name is a String, but the ArrayList contains Accounts. Bank class doesn't need an atrribute balance, Account...
Type: Posts; User: PhHein
Better, but it still needs a lot of work. Your check account.contains(name) won't work as name is a String, but the ArrayList contains Accounts. Bank class doesn't need an atrribute balance, Account...
You've still got it wrong. The bank(class) is your room, in your room there is a folder(Arraylist) and with every 'enroll' call you put a new sheet with a name and balance(Account) into the folder....
Ok. You're confused. Your ArrayList will contain Accounts not Strings. The ArrayList will be created once. In enroll you create a new Account and add it to the ArrayList.
You didn't read the assignment properly! It says: The central class is "Bank" that contains the accounts (an ArrayList).
creating an instance means:
Bank b = new Bank();
CommandReader reader = new CommandReader(b);
Put the main method into Bank, create an instance of Bank. Create an instance of CommandReader using the constructor, that you've commented. Call Command reader's run() method.
please format your code Announcements - What's Wrong With My Code?
What have you tried? - Matt Gemmell
Post your code and ask specific questions. Nobody will do your assignment for you.