A function that returns a special error code is usually better accomplished throwing an exception instead. The following class maintains an account balance:
Rewrite the class so that it throws appropriate exceptions instead of returning −1 as an error code. Write test code that attempts to withdraw and deposit invalid amounts and catches the exceptions that are thrown.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.