solve the programming assignment2