hi all, i am building a squared pyramid calculator and writing all the code from scratch, but I seem to have run into my first problem though. i am giving the user a welcome message and then giving them a dropdown menu asking them what they want to "adjust" for the pyramid. the four options they can adjust are the height, baselength, height and baselength of the pyramid, or they can just exit. now from here whatever option they choose( except for the exit option) an input dialog will pop up asking to enter the new value/values for whatever they chose. I've just tried the first option just to see if it works but with no luck whenever i click on adjust height which is indexed at 0 the program just ends and ignores my if statement which is if the option is indexed at 0 then a joptionpane input dialog should pop up what am i doing wrong?
import javax.swing.*;
public class MainP2 {
public MainP2() {
JOptionPane.showMessageDialog(null,
"Hi welcome to my square Pyramid calculator." + "\nPress Ok to begin.",
"CIS 2235",
JOptionPane.PLAIN_MESSAGE);
String[] possibilities = {"adjust height", "adjust baselength", "adjust height and baselength", "exit" };
String s = (String)JOptionPane.showInputDialog(
null,
"Choose one",
"Customized Dialog",
JOptionPane.PLAIN_MESSAGE,
null,
possibilities,
possibilities[0]);
//////////////heres the problem with the code am i calling it wrong?////////////
///////////////////////////////////////////////////////////////////////////////
if(possibilities.equals(possibilities[0])){
String myString = JOptionPane.showInputDialog(null,
"Please enter height: ");
}
}
public static void main (String[] args) {
MainP2 app = new MainP2();
}
}