Programm Assignment 2

wrong use of caching variable