Java OOP GUIDE / WORK DURATION CLASS SOLUTIONS TASK –
PART 1 – DURATION CLASS
|
||
TASK – PART 2 – TESTING
THE DURATION CLASS Here is my
solution:
The above
will output:
TASK – PART 3 – SHORT
ANSWER QUESTIONS a)
Constructor
#2 (and Constructor #3) can be accidentally misused. Can you predict how a programmer might make
an error?
b)
The
method getTotalSeconds() requires a calculation that might be challenging for
some. How would you test it to make
sure that is working correctly like it is intended to be? |