November 2016
Intermediate to advanced
480 pages
14h 42m
English
The emptyGas(by:) method has some bugs. For example, if the current gasLevel is less than the amount to remove, then the new value for this property will be negative. A negative value does not make sense and will actually stop the program from running (recall the precondition() in gasLevel’s property observer). Revise emptyGas(by:)’s implementation to ensure that gasLevel is not decremented to be a negative value.
Read now
Unlock full access