IBS Software interview question

Was given a scenario and asked to write a code