Code to practise factory method is complete.