To the extent that your "sample scenarios" can be automated, write
a test()
method or function that generates instances of
various classes and invokes methods that involve interaction among
them. If your "sample scenarios" are driven by user input, you may
need to just start up the program and try each scenario by hand.
test()
method.
If it
produces run-time errors, read the error messages carefully, figure
out what they mean, fix them, and compile again until there are no
syntax or run-time errors.
test()
method,
observe the actual output. If it's not what you
expected, either you were expecting the wrong thing (possible,
though unlikely) or there's a bug in your program. Figure out
how the answer is wrong (not just that it's wrong)
and how this wrong answer could have happened, fix it, and compile
and run again. When you fix a bug, be sure to re-examine the
previously working examples to make sure they still work!