import java.util.Scanner; public class LuigisPizzaProcedures2Program { public static void displayMenu() { System.out.println("Luigi's Pizza "); System.out.println("-------------------------------------------"); System.out.println(" S(SML) M(MED) L(LRG)"); System.out.println("1. Cheese 5.00 7.50 10.00 "); System.out.println("2. Pepperoni 5.75 8.63 11.50 "); System.out.println("3. Combination 6.50 9.75 13.00 "); System.out.println("4. Vegetarian 7.25 10.88 14.50 "); System.out.println("5. Meat Lovers 8.00 12.00 16.00 "); } public static int getPizzaKind(Scanner keyboard) { System.out.println("What kind of pizza do you want (1-5) ?"); return keyboard.nextInt(); } public static char getPizzaSize(Scanner keyboard) { System.out.println("What size of pizza do you want (S, M, L) ?"); return keyboard.next().charAt(0); } public static float computeCost(int kind, char size) { float c = 4.25f + (kind * 0.75f); if (size == 'M') c *= 1.5f; else if (size == 'L') c *= 2; return c; } public static void displayResults(float c) { System.out.println("The cost of the pizza is: " + String.format("$%,1.2f", c)); System.out.println("The price with tax is: " + String.format("$%,1.2f", c * 1.13)); } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int kind; char size; float cost; displayMenu(); kind = getPizzaKind(keyboard); size = getPizzaSize(keyboard); cost = computeCost(kind, size); displayResults(cost); } }