Problem solution using oop concepts.