code for usecase4