added object oriented versions of problem