Instructions are in the image above. This is what I have now. Everything is done except the last part where if you click Yes the program is supposed to continue with other calculations. This is where am stuck.

import javax.swing.JOptionPane;

public class OPTIMA2 {

public static void main(String[] a) {
String[] choices = { "NORMAL","GOLD", "SILVER", "NORMAL", "DEFAULT" };
String input = (String) JOptionPane.showInputDialog(null, "What is the customer level? ","Optima Customer Level", JOptionPane.QUESTION_MESSAGE, null, 
    choices, // Array of choices
    choices[0]); // Initial choice

if ((input == null)) {
    System.exit(0);

    }
    System.out.println(input);

if(choices[0]=="NORMAL"){
    int input3 = JOptionPane.showOptionDialog(null, "Level is Normal Reward is 15 percent", "OPTIMA_sadiq", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
    if(input3 == JOptionPane.OK_OPTION)
{
    System.out.println("Do you want to continue with other entry? ");

    int input4 = JOptionPane.showConfirmDialog(null, "Do you want to continue with other entry? ", "OPTIMA_sadiq", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,null);
    if(input4 == JOptionPane.YES_OPTION)
{

  //This is where am stuck if you click Yes the program it is supposed to continue with other calculations      
}
}

    else if (input3 == JOptionPane.CANCEL_OPTION){
        System.exit(0);
    }

}
else if(choices[1]=="GOLD"){
    JOptionPane.showMessageDialog(null, "Level is Gold Reward is 25 percent", "OPTIMA_sadiq", JOptionPane.INFORMATION_MESSAGE);
}

else if(choices[2]=="SILVER"){
    JOptionPane.showMessageDialog(null, "Level is Silver Reward is 20 percent", "OPTIMA_sadiq", JOptionPane.INFORMATION_MESSAGE);
}

else if(choices[3]=="NORMAL"){
    JOptionPane.showMessageDialog(null, "Level is Default Reward is 5 percent", "OPTIMA_sadiq", JOptionPane.INFORMATION_MESSAGE);
}

else if (choices[4]=="DEFAULT"){
    //int input2 =JOptionPane.showOptionDialog(null, "Level is Normal Reward is 15 percent", "OPTIMA_sadiq", JOptionPane.OK_OPTION, JOptionPane.CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null);

    int input3 = JOptionPane.showOptionDialog(null, "Level is Default Reward is 15 percent", "OPTIMA_sadiq", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
    if(input3 == JOptionPane.OK_CANCEL_OPTION)
{
    System.out.println("Do you want to continue with other entry? ");

    JOptionPane.showMessageDialog(null, "Do you want to continue with other entry? ", "OPTIMA_sadiq", JOptionPane.QUESTION_MESSAGE);
}
    else{
        JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);
    }

}

}
}

What is supposed to happen when the user say "yes" - do some other stuff and return to that point, or exit from what you are doing then go on to the other stuff?

@JamesCherrill it should return to the InputDialog and the user can choose another lets say Gold. It is like a loop meaning the calculations will continue until a user eventually clicks No or cancel

So something like this?

do {

    // process one pass of user input

} while (JOptionPane.showConfirmDialog(
       null, "Do another one?", "Continue", JOptionPane.YES_NO_OPTION) 
                == JOptionPane.YES_OPTION);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.