Question: Please write in java! Do each method as its own program, dont join the two together. Use timer provided in picture for each different program...

Please write in java! Do each method as its own program, dont join the two together. Use timer provided in picture for each different program... Please! Do not do iterative and recursive methods in same program!! Do two separate programs!! Please include documentation. Last person did not read instructions at all and program was not correct at all.  Please write in java! Do each method as its own program,

Lab # 2 Fibonacci Sequence Write a recursive and an iterative function to calculate the nth element in a Fibonacci sequence. A Fibonacci sequence is defined as the element 1, followed by another 1, and each element thereafter is the sum of the previous two elements. For example, the first 9 elements of a Fibonacci sequence are: 12358 13 21 34 This famous sequence was originally used to predict the growth of rabbit populations Once you have each of the functions working for n qual to 40, determine which method is more efficient by timing the two separate function calls and printing out the time required for each method call to return the 40th element in the sequence. Return the 40th element to main and print it. After that, print out a complete Fibonacci sequence from element 1 to element 40, along with its position number 2. 1 3. 2 4. 3 This last part should not be timed. The timer function you need for this Project is: new Date(); long milliseconds # D1.getTime(); OR Date d1 long start System.currentTimeMillis()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!