问题是:
问:编写一个程序,使用对话框提示用户选择比萨的尺寸——S、M、L 或 X——然后相应地显示价格为 6.99 美元、8.99 美元、12.50 美元或 15.00 美元。将程序另存为 PizzaChoice.java。
这个问题我需要通过 JOptionPane 使用对话框来处理 if/else 语句。
public class PizzaChoice {
public static void main(String[] args) {
String choice;
String small;
String medium;
String extraLarge;
choice= JOptionPane.showInputDialog("Enter yur choice of pizza :"+" S, M, L, X");
double s,S;
//double s2= Double.parseDouble(small);
if(s==S ){
System.out.println("$6.99"+s);
}
}
}
我不能比这更进一步。我尝试了许多不同的方法,但仍然无法很好地编码。