Integral (MI) interview question

Code using Test Driven Development