Prac7: question1 implementation