//FibonacciSteps.java // climb steps one or two at a time: the ways to climb n steps import java.awt.*; import javax.swing.*; public class FibonacciSteps extends JApplet { String [] FN; int maxF; public void init() { String []FN1 = new String[1]; String []FN2 = new String[1]; int Fn=0, Fn1=1, Fn2=1; double phi= (1.0 + Math.sqrt(5)) / 2; String input = JOptionPane.showInputDialog("Number of steps ","8"); maxF = Integer.parseInt(input); maxF++; FN1[0] = "1"; FN2[0] = ""; System.out.printf("%2d %6d \n",1,Fn2); System.out.printf("%2d %6d %s\n",2,Fn1,FN1[0]); for (int n=3; n<=maxF; n++) { Fn = Fn1 + Fn2; System.out.printf("%2d %6d %12.4f %8.6f ", n,Fn,(Math.pow(phi,n)/Math.sqrt(5)),((double)Fn/Fn1)); FN = new String[Fn]; for (int j=0; j