code for Scenario 1.