There's all sorts of errors in the above code I can see at a glance:
toString()
isn't returning anything (it just declares a local variable that's then immediately garbage collected as the method ends)
addCustomer()
doesn't always return something.
infoCustomer()
and removeCustomer()
never return anything, despite declaring that they should in the method header
addSavingsAccount()
should return an int (according to the method header), but only returns a string - sometimes.
- Unless
Customer
has a public field called SavingsAccount
(which would be hideously bad design from so many respects) then a.SavingsAccount.getAccountId()
and similar is wrong, you probably want the method on Customer
that gets its particular savings account.
You need to get into the habit of checking your code in much smaller increments, at least until you have a handle on the basic syntactical side of things. That way you won't end up in these sorts of scenarios where there's a ton of errors that you have to fix, with no real knowledge of how to fix them.
Every time you add (for instance) a method: stop, compile, check it works as you want it to, and only then move onto the next thing. It'll save you a heck of a lot of time in the long run.