Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I was hoping someone might be able to give a little explanation orsolution as to

ID: 3617582 • Letter: I

Question

I was hoping someone might be able to give a little explanation orsolution as to how I might properly setup some recursive Fibonaccicode here. I'm still quite new to methods, and new torecursion. Please help me out. Thanks.

public class Fibonacci{
    public static long fib(int max)
    {
        System.out.println("CalledFibonacci (" + max + ")");
        long result;
        if (max <= 1)
            result =1;
        else
            result =max-2 + fib(max-1); //PLEASE HELPHERE
       System.out.println("Returned Fibonacci (" + max + ") = " +result);
        return result;
    }

    public static void main(String[] args) {
        final int MAXSIZE = 100;
        long[] arr = newlong[MAXSIZE];

        System.out.println("FibonacciNumber 5 is " + fib(5));
        System.out.println("FibonacciNumber 10 is " + fib(10));
        System.out.println("FibonacciNumber 20 is " + fib(20));
        System.out.println("FibonacciNumber 15 is " + fib(15));
        System.out.println();

    }
}

Explanation / Answer

public classFibonaccion {     public static longfib(int max)     {        System.out.println("Called Fibonacci (" +max + ")");         longresult;         if (max
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote