This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a program that i need to complete. I wrote the first one (FibonacciGenerator) with stated variables - everything worked fine
I now want to split it up so that the user can give a number and the program gives the correct number back. (ie, fib(5)=5 AND NOT fib(5)=2)
Please help as I know what i need to do but the how escapes me.
Test Program (I know i need to return the input to the constructor file but how??)
Your Fibonacci class works, if you ignore the element 0. I've changed your test program a bit:
You'll need to check the logic of your tester. You skip nextNumber for 1 and 2, so it skips the calculation of fib(1) and fib(2).