Enhance the Fibonacci program of Fig. 18.5 so that it calculates the approximate amount of time required
Question:
Enhance the Fibonacci program of Fig. 18.5 so that it calculates the approximate amount of time required to perform calculation and the number of calls made to the recursive method. For this purpose, call static System method currentTimeMillis, which takes no argument and returns the computer's current time in milliseconds. Call this method twice - once before and once after the called to fibonacci. Save each value and calculate the difference in the times to determine how many milliseconds were required to perform the calculation. Then add a variable to the FibonacciCalculator class, and use this variable to determine the number of calls made to method fibonacci. Display your results.
Principles of Taxation for Business and Investment Planning 2016 Edition
ISBN: 9781259549250
19th edition
Authors: Sally Jones, Shelley Rhoades Catanach