The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Using the attached program file Make the program an Application replacing the input of a number as the index to be used to calculate Fibonacci with a GUI interface as follows: A title with your last name - Fibonacci Calculator. A slider control from 0 to 10 that updates a text field with a label "Index: " with the value of the position of the slider. A button that says "Calculate Fibonacci". A text field with the label "Fibonacci #: ". When the slider is moved, the Fibonacci field must be set to spaces. Only when the button is pressed should the field be updated to the calculated Fibonacci #.
Â
Â
package piazzafibonaccicalculator;import java.util.Scanner;public class PiazzaFibonacciCalculator {public static void main(String args[]) {Scanner input = new Scanner(System.in);System.out.print("Enter an index for the Fibonacci number: ");int index = input.nextInt();System.out.println("Fibonacci number at index " + index + " is " + fib(index));}public static long fib(long index) {if (index == 0)return 0;else if (index == 1)return 1;elsereturn fib(index - 1) + fib(index - 2);}}
Attachments:
-----------