import javax.swing.*; public class Cashier { public static void main(String[] args) { String item; double total = 0.0, milkPrice = 3.50, bottleWaterPrice = 1.0; double sugarPrice = 1.25; // Notice you can have if inside of whiles. There is a better way // to write the if. We will take a look at that latter on do { item = JOptionPane.showInputDialog("Enter Item Description"); if (item.equals("milk")) { total = total + milkPrice; } else { if (item.equals("bottleWater")) { total = total + bottleWaterPrice; } else { if (item.equals("sugar")) { total = total + sugarPrice; } } } } while (!item.equals("end")); JOptionPane.showMessageDialog(null, "Amount Due: $" + total); System.exit(0); } }