Write a JAVA program to solve the following problem. Your program should properly compile and run and
Question:
Write a JAVA program to solve the following problem. Your program should properly compile and run and is well documented. You need to upload into Moodle the following:
The electronic version of your SINGLE source code file after you successfully compiled and ran it. Please label your file appropriately.
Very Important Note: Do NOT upload any other files into Moodle; just ONE file with the extension “.java”.
1. Fibonacci numbers are defined by the sequence:
f1 = 1
f2 = 1
fn = fn-1 + fn-2
You need to write a Java program that prompts the user to enter the value of an integer (n) then checks if n is in the acceptable range. The acceptable range is from 1 to 50. If the user supplies a value out of the valid range, the program MUST reject it and ask the user again to enter a valid value for n. The above check needs to be implemented by a sentinel loop.
After receiving a valid value for n, the program will compute the values for all the terms of the Fibonacci series up to and including n then display these values on the screen. Output should be formatted such that each line has five values and each value is displayed left justified in a field width of 15, see the screen shot.
Computing the Fibonacci series is simple. The first two terms are predefined and after that any term is the summation of the previous two terms. Sample output is given below in case the user wants the first 50 terms.
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood