Fibonacci Cal
Fibonacci Cal
JOptionPane;
Import java.math.BigInteger;
If (n <= 1) {
Return BigInteger.valueOf(n);
Result.append(fibonacciRecursive(i)).append(“ “);
Return result.toString();
While (continueProgram) {
String input = JOptionPane.showInputDialog(null, “Enter the desired
length of the Fibonacci sequence (or press Cancel to exit):”);
If (input == null) {
programCanceled = true;
break;
Try {
If (length < 1) {
Continue;
Null,
JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE,
Null,
Options,
Options[0]
);
String result;
If (choice == 0) {
Result = fibonacciRecursiveSequence(length);
} else {
Continue;
JOptionPane.showMessageDialog(null, result);
Null,
“Continue or Exit”,
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
Null,
“Yes”
);
If (continueChoice == JOptionPane.NO_OPTION) {
continueProgram = false;
}
} catch (NumberFormatException e) {
If (!programCanceled) {