representing real life situation using funtion