Infosys interview question

Code for encapsulation and abstraction.