the program has been done for homework5