Writing clean OOP style code can be tricky sometimes. I have shared my code below. I was just playing with codes and tried to refactor my code to improve it.