Results 1 to 2 of 2
  1. #1
    Southpaw is offline Member
    Join Date
    Dec 2012
    Rep Power

    Default Having a Problem with FibonacciJDialog program.

    I cant get the sum to return any results in the jdialog program. Also on a side note i have to limit number n to the value 40 maximum. Im also required to use long as a value for the returned results.
    The coding that i have so far is:
    public class Fibonacci
    public long Fib(long n)
    long in1=1,in2=1;
    long sum=0;//initial value
    long index=1;

    while (index<n)
    // sum=the sum of 2 values;
    // in1 gets in2
    // in2 gets sum
    // increment index
    return sum;
    The input Jdialog Program is:
    import javax.swing.JOptionPane;

    public class FibonacciJDialog

    public static void main(String[] args)

    String input = JOptionPane.showInputDialog("Enter n: "); // getting user number input.
    long n = long.parseInt(input);

    Fibonacci box = new Fibonacci(); // Creating new Fibonacci object.

    JOptionPane.showMessageDialog(null,"That Fibonacci Number is" ); // Display results in dialog box.
    return sum;

    System.exit(0); // Terminate

    Thanks for any help.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Having a Problem with FibonacciJDialog program.

    Go through the Forum Rules -- particularly the second and third paragraphs.


    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Small problem with problem with Java, C++ parse program.
    By dragstang86 in forum New To Java
    Replies: 4
    Last Post: 10-30-2011, 03:43 AM
  2. what is the problem in this program ?????
    By sahildave1991 in forum AWT / Swing
    Replies: 1
    Last Post: 06-29-2010, 01:36 PM
  3. Problem with the below program
    By srikanthnambu in forum Java 2D
    Replies: 1
    Last Post: 05-20-2009, 05:43 PM
  4. Gui program problem..
    By mingming2009 in forum Advanced Java
    Replies: 7
    Last Post: 04-03-2009, 05:15 AM
  5. Program problem
    By arindamchkrbrty in forum New To Java
    Replies: 8
    Last Post: 03-10-2009, 04:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts