Implemented and tested problem 7.