Solving the Exercise using Object Oriented concepts