Results 1 to 3 of 3
 03212013, 05:11 AM #1Member
 Join Date
 Jan 2013
 Location
 'Murica
 Posts
 25
 Rep Power
 0
Help! Code won't run in JOptionPane, displaying process complete
Hello I am Aaron,
I am currently having troubles running this code, when i click on Program 6 it wont load, and will say process complete please help? Unnecessary code was removed, which was not pertaining to this question, that is why it states create me. Can you please state what or how im doing it wrong, or be kind and helpful and edit my coding. Thank you. Please reply soon, within 12 hours max! Please
Java Code:import javax.swing.*; public class MenuSetUp { static Object[] menu = {"Program 2", "Program 4.", "Program 5", "Program 6.", "Exit"}; //This is the array list that will help give the user choices on what //program to pick and run or will help exit the program if the program //if the user wants to exit. public static void main(String[] args) { { Object options = JOptionPane.showInputDialog(null,"Please select a "+ " program :", "Menu", 3, null, menu, menu[0]); if (options == null  options.equals("Exit")) //This is the if statement that will be excuted // if the user selects exit { System.out.print("The program is terminated"); } else if(options.equals("Program 2")) { //creat me } else if(options.equals("Program 4")) { //create me } else if(options.equals("Program 5")) { //creat me } else if(options.equals("Program 6")) { //These are the varibles of the program String a= " "; String b= " "; String c= " "; String intro = " "; double valOfA=0.0; double valOfB=0.0; double valOfC=0.0; double eq=0.0; double r1=0.0; double r2=0.0; double Root1=0.0; double Root2=0.0; int rerunOption = JOptionPane.YES_OPTION; //************************************************************* //The message that is displayed in the intro of the //program intro += "Hello and welcome to this Phenomenal program"; intro += "This program will you solve for the 2"; intro += "roots of a quadratic formula"; intro += "\nPlease enter your information as directed"; intro += "This program will ask you to enter the values"; intro += "of a, b and c and this wonderful program will"; intro += "do the rest as you relax for a second, this"; intro += "can help speed up, your homework, or"; intro += "assignment. Enjoy and have a nice day!"; //This is the actual introduction of the program JOptionPane.showMessageDialog(null, intro, "Program 6", JOptionPane.INFORMATION_MESSAGE); //************************************************************* //Asks the user to input the value of a a = JOptionPane.showInputDialog(null, "Enter the value of a:"+ "Quadratic Formula Solver", JOptionPane.QUESTION_MESSAGE); //The following code parses the string number input to an //integer //that is used for the calculations valOfA = Double.parseDouble(a); //Asks the user to input the value of a b = JOptionPane.showInputDialog(null, "Enter the value of b:"+ "Quadratic Formula Solver", JOptionPane.QUESTION_MESSAGE); //The following code parses the string number input to // an integer //that is used for the calculations valOfB = Double.parseDouble(a); //Asks the user to input the value of a c = JOptionPane.showInputDialog(null, "Enter the value of c:"+ "Quadratic Formula Solver", JOptionPane.QUESTION_MESSAGE); //The following code parses the string number input to an //integer //that is used for the calculations valOfC = Double.parseDouble(a); eq=Math.pow(valOfB,2)(4*valOfA*valOfC); /*This is the base of the quadratic equation/formula *excluding the b *(Negative of the YIntercept) and the division of 2 *This is where the b ( is squared (b*b) then substracted *by the 4 *which is also multiplied by the a and c (4*a*c) */ r1 = ((0valOfB)+Math.sqrt(eq)); //The First part of the quadratic equation/formula output, // where the b (Negative of the YIntercept)is added to // the square //root of the base (eq) r2 = ((0valOfB)Math.sqrt(eq)); //The First part of the quadratic equation/formula output //where the b //(Negative of the YIntercept)is substracted to the square //root of the base (eq) Root1 = (r1/2)*valOfA; //The Second part of the quadratic equation/formula output // where the b //added to the the square root of the base (eq) is divided // by 2 // then multiplied by a Root2 = (r2/2)*valOfA; //The Second part of the quadratic equation/formula output // where the b // substracted to the the square root of the base (eq) is // divided by 2 a // then multiplied by a //The final output of the program JOptionPane.showMessageDialog(null, "The value of Root 1 is " + Root1 +" The value of Root 2 is ", "Program 6", JOptionPane.INFORMATION_MESSAGE); } } } }
Last edited by 765891; 03212013 at 05:15 AM.
 03212013, 05:26 AM #2Senior Member
 Join Date
 Jun 2007
 Location
 Bali, Indonesia
 Posts
 762
 Rep Power
 13
Re: Help! Code won't run in JOptionPane, displaying process complete
Hello,
Can you spot the cause of error from these lines?
Java Code:static Object[] menu = {"Program 2", "Program 4.", "Program 5", "Program 6.", "Exit"};
Java Code:else if(options.equals("Program 6"))
Last edited by wsaryada; 03212013 at 05:31 AM.
Website: Learn Java by Examples
 03212013, 05:37 AM #3Member
 Join Date
 Jan 2013
 Location
 'Murica
 Posts
 25
 Rep Power
 0
Similar Threads

ANYCODE FOR JOPTIONPANE CANCEL and OK BUTTON TO COMPLETE?
By irnie1994 in forum JCreatorReplies: 1Last Post: 12142011, 10:23 PM 
I need urgent help to complete this code please!
By kenson02 in forum New To JavaReplies: 3Last Post: 12142011, 02:37 AM 
complete the code
By blackz in forum New To JavaReplies: 2Last Post: 09112011, 02:04 AM 
displaying tables in joptionpane
By kaemonsaionji in forum New To JavaReplies: 2Last Post: 02262009, 06:53 AM 
Displaying numbers per line on a JOptionPane.showMessageDialog screen
By zoe in forum New To JavaReplies: 1Last Post: 07312007, 04:01 AM
Bookmarks