import java.util.Scanner; public class LuigisPizzaFunctionsProgram { 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 getKind(Scanner keyboard) { System.out.println("What kind of pizza do you want (1-5) ?"); return keyboard.nextInt(); } public static char getSize(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 cost = 4.25f + (kind * 0.75f); if (size == 'M') return cost * 1.5f; else if (size == 'L') return cost * 2; return cost; } public static void displayResults(float cost) { System.out.println("The cost of the pizza is: " + String.format("$%,1.2f", cost)); System.out.println("The price with tax is: " + String.format("$%,1.2f", cost * 1.13)); } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); displayMenu(); displayResults(computeCost(getKind(keyboard), getSize(keyboard))); double[] weights = {4.5, 23.6, 84.1, 78.2, 61.5}; double sum = 0; for (int i=0; i<=weights.length; i++) sum = sum + weights[i]; } }