Question: The program Fills a one-dimensional array with the first 20 Fibonacci numbers using a calculation to generate the numbers. Note: The first two Fibonacci numbers

The program Fills a one-dimensional array with the first 20 Fibonacci numbers using a calculation to generate the numbers. Note: The first two Fibonacci numbers 0 and 1 should be generated explicitly as in long[] series = new long[limit]; //create first 2 series elements series[0] = 0; series[1] = 1; But, it is not permissible to fill the array explicitly with the Fibonacci series after the first two elements (0 and 1). From that point on the numbers must be calculated. The program prints the first 20 Fibonacci numbers in the array separated by a comma and a space. Asks the user which of the numbers in this series of 20 he wants to see and prompts for an integer input - a number between 1 and 20(inclusive). So if the user wants to see the fifth (5th) number of the Fibonacci series the user would input the integer 5 in response to the prompt. Checks that the user has not input a number lower than 1 or higher than 20 Prints in response to the user entry "The nth Fibonacci number is X", where n is the number input by the user and X is the nth Fibonacci number. (Array indexes for the elements of the array start at 0), Example: If user inputs "6" in response to the prompt, the program would print "The 6th Fibonacci number is 5." (without the quotes) You can check if you have the right numbers here: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibtable.html (Links to an external site.)Links to an external site. Submission: Submit your work in a folder labeled XXXFibonacci where the XXX stands for the initials of your first, middle and last names. Compress the folder as usual using the .zip utility of your operating system. Make sure your first comment in your code is similar to the first commment in the lewis and Loftus programs in your text. The comment should include the class name, your name and section number at a minimum. //****************************************************************************************** // Fibonacci.java Author: Your Name Section: Your section number // // Representsthe first n integers of the Fibonacci series and prints them // then prints the nth number selected by the user //*****************************************************************************************

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!