Thoughtworks Interview Question

Code pairing- oops desing question