Created
May 12, 2021 00:41
-
-
Save j2deme/6e805bfb74365022ba65c9812fa2156d to your computer and use it in GitHub Desktop.
La Pizzería
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.j2deme; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
int tipo = 0; | |
int ingrediente = 0; | |
String nombreIngrediente = ""; | |
Scanner teclado = new Scanner(System.in); | |
System.out.println("= Bienvenido a la Pizzería de Don Cangrejo ="); | |
System.out.println("¿Qué tipo de pizza quieres?" + | |
"\n1) Vegetariana" + | |
"\n2) No vegetariana"); | |
tipo = teclado.nextInt(); | |
switch(tipo){ | |
case 1: | |
System.out.println("= Ingredientes Vegetarianos ="); | |
System.out.println("Elige un ingrediente:" + | |
"\n1) Pimiento" + | |
"\n2) Champiñón" + | |
"\n3) Tofu" + | |
"\n4) Piña"); | |
ingrediente = teclado.nextInt(); | |
switch (ingrediente){ | |
case 1: nombreIngrediente = "Pimiento"; break; | |
case 2: nombreIngrediente = "Champiñón"; break; | |
case 3: nombreIngrediente = "Tofu"; break; | |
case 4: nombreIngrediente = "Piña"; break; | |
default: nombreIngrediente = "no válido"; break; | |
} | |
System.out.println("Resumen del pedido: Pizza Vegetariana con Tomate, " + | |
"Queso y " + nombreIngrediente); | |
break; | |
case 2: | |
System.out.println("= Ingredientes No Vegetarianos ="); | |
System.out.println("Elige un ingrediente:" + | |
"\n1) Pepperoni" + | |
"\n2) Jamón" + | |
"\n3) Tocino"); | |
ingrediente = teclado.nextInt(); | |
switch (ingrediente){ | |
case 1: nombreIngrediente = "Pepperoni"; break; | |
case 2: nombreIngrediente = "Jamón"; break; | |
case 3: nombreIngrediente = "Tocino"; break; | |
default: nombreIngrediente = "no válido"; break; | |
} | |
System.out.println("Resumen del pedido: Pizza No Vegetariana con Tomate, " + | |
"Queso y " + nombreIngrediente); | |
break; | |
default: | |
System.out.println("Opción no válida"); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment