Exemplo n.º 1
0
 public Extras(BurguerKing hamburguesa) : base(hamburguesa)
 {
     while (true)
     {
         try
         {
             Console.WriteLine("Digite el primer ingrediente extra");
             ingrExtra1 = Console.ReadLine();
             if (string.IsNullOrEmpty(ingrExtra1) == true || Regex.IsMatch(ingrExtra1, @"[\p{L} ]+$") == false)
             {
                 throw new ArgumentException();
             }
             break;
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
     while (true)
     {
         try
         {
             Console.WriteLine("Digite el segundo ingrediente extra");
             ingrExtra2 = Console.ReadLine();
             if (string.IsNullOrEmpty(ingrExtra2) == true || Regex.IsMatch(ingrExtra2, @"[\p{L} ]+$") == false)
             {
                 throw new ArgumentException();
             }
             break;
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Exemplo n.º 2
0
 private void addIngr(BurguerKing hamburguesa)
 {
     Console.WriteLine("Primer ingrediente extra: {0}\nSegundo ingrediente extra: {1}", ingrExtra1, ingrExtra2);
 }
Exemplo n.º 3
0
 public IngredientesExtras(BurguerKing hamburguesa)
 {
     this.hamburguesa = hamburguesa;
 }