|
Sure! It doesn't do a whole lot at the moment, but everything in the code is good. The only thing I noticed was that there is a possibility that you don't return anything, which would cause an error. Since you said that the method would return a double, it has to eventually return a double.
The case where it wouldn't return a double would be if amount > totalBalance. In that case, you say it is going to give an error message. It might be better to return something like a -1 (or some other obscure value that it shouldn't be returning) and then handle the error outside of the method, wherever you call it.
Erm... does that make sense? The main thing I'm trying to say is that if you say you are going to return a double, you have to return a double no matter what.
|