# (Solved) : Write Application Contains Two Versions Fibonacci Routine First Version Recursivefibonacci Q42769043 . . .

Write an application that contains two versions of Fibonacciroutine. The first version “RecursiveFibonacci” is a recursiveimplementation The second version “MemoizFibonacci” will beimplemented using the “top-down” approach that combines recursionwith memorization). The “MemoizFibonacci” routine must dynamicallyallocate an array of size “n” (that will be used to store thevalues of Fibonacci values that are stored avoid additionalrecursive calls). The application must perform the following

1. Allows the user to input the value “n”
2. Calls the “RecursiveFibonacci” routine
• Writes a message to RecursiveFibonacciFile each time theroutine is called
• Writes the value of RecursiveFibonacci(n) to the file (where“n’ is the initial value that was input
3. Calls the “MemoizFibonacci” routine
• Writes a message to MemoizFibonacciFile each time the routineis called
• Writes the value of RecursiveFibonacci(n) to the file (where“n’ is the initial value that was input)

Here is what I have so far. Need to add in an input method andoutput to text. I think I can manage the rest.

import java.util.Arrays;
import java.util.Scanner;
public class HelloAndroid {
public static void main(String args[]) {
fibonacci(8);
fibonacci(9);
fibonacci(10);
fibonacciSeries(11);
fibonacciSeries(12);
} /* * Printing Fibonacci series of a given number using for loop*/
public static void fibonacci(int number) {
int fibo1 = 1;
int fibo2 = 1;
System.out.printf(“%nFibonacci series of %d numbers are : “,number);
System.out.printf(“%s “, fibo1);
System.out.printf(“%s “, fibo2);
for (int i = 2; i & lt; number; i++) {
int fibonacci = fibo1 + fibo2;
System.out.printf(“%s “, fibonacci);
fibo2 = fibo1;
fibo1 = fibonacci;
}
}
public static void fibonacciSeries(int number) {
System.out.printf(“nFibonacci series in Java of number %s usingrecursion %n”, number);
for (int i = 1; i & lt; = number; i++) {
System.out.printf(“%s “, getFibonacci(i));
}
} /* * Fibonacci series in Java of a given number Recursion.*/
public static int getFibonacci(int n) {
if (n == 1) {
return 1;
}
if (n == 2) {
return 1;
}
return getFibonacci(n – 1) + getFibonacci(n – 2);
}
}

Answer to Write an application that contains two versions of Fibonacci routine. The first version “RecursiveFibonacci” is a re…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.