Standford open course " Programming Methodology " assignment 7