hi i am new to java programming and im working on a looping program involving the fibonacci numbers.

what i would like to do is to have a program that asks the user how many values of the Fibonacci sequence to output. Then i want to create a loop that outputs the number of values of the Fibonacci sequence requested by the user.

i only want to use the do....while loop, for loop, and the while loop

the following code i will post does not do what i want and i cannot figure out why

first off when i input a number it doesnt display the desired out......it just displays the same exact 15 numbers

and second my for loop works but all the other ones do not

any help would be very much appreciated ty

import javax.swing.JOptionPane; public class Lab4 { public static void main(String[] args) { String aString="15"; String userInput = JOptionPane.showInputDialog("How many values of the Fibonacci sequence would you like?"); int aInt = Integer.parseInt(aString); for1(); do1(); while1(); for2(); do2(); while2(); } public static void for1() { String aString="15"; String userInput = JOptionPane.showInputDialog("How many values of the Fibonacci sequence would you like?"); int aInt = Integer.parseInt(aString); for(int i = 1; i <= aInt; i++) { int f = fib(i); System.out.println("Fib(" + i + ") = " + f); } } public static void do1() { String bString="15"; String userInput = JOptionPane.showInputDialog("How many values of the Fibonacci sequence would you like?"); int bInt = Integer.parseInt(bString); do { int f = fib(i); } while(int h = 1; h <= bInt; h++); System.out.println("Fib(" + h + ") = " + f); } public static void while1() { String cString="15"; String userInput = JOptionPane.showInputDialog("How many values of the Fibonacci sequence would you like?"); int cInt = Integer.parseInt(cString); while(int i = 1; i <= cInt; i++) { int f = fib (i); System.out.println("Fib(" + i + ") = " + f); } public static int fib(int n) { if (n <= 2) return 1; else return fib(n - 1) + fib(n - 2); } }