import javax.swing.*;
public class Main {
public static void main(String[] args) {
final double NUMBER_OF_PIZZAS = 4;
String[] validValues = {"S", "M", "L", "X"};
double[] prices = {6.99, 8.99, 12.50, 15.50};
String strItem;
int entry;
boolean validItem = false;
double itemPrice = 0.0;
strItem = JOptionPane.showInputDialog(null, "Enter the pizza size you want.\nS - Small\nM - Medium\nL - Large\nX - Extra Large");
for (int x = 0; x < NUMBER_OF_PIZZAS; ++x) {
if (strItem.equalsIgnoreCase(validValues[x])) {
validItem = true;
itemPrice = prices[x];
}
}
if (validItem) {
JOptionPane.showMessageDialog(null, "The price of a " + strItem + " pizza is $" + itemPrice);
} else {
JOptionPane.showMessageDialog(null, "That's not a valid pizza");
}
}
}