TestCache

Write a function called calculateAnswer()that takes integer nas input and calculates (and returns)the sum (1 + 2 + … + n)
▪Pretend this method is computationally costly!
Initially, the cache (holds only 11 elements) is empty
▪Ask the user to input a number in range 1..100
▪If the answer is not in the cache, call calculateAnswer()and display the resulting sum; store the result in the cache
▪If the answer is in the cache, simply display the answer