code for use case2