Advertisement
s00rk

Esteban & Paul <3

Sep 26th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Collections;
  5.  
  6. namespace Restaurant
  7. {
  8.     class Program
  9.     {
  10.         public Mesa [] mesas;
  11.         public Platillo[] platillos;
  12.         public Hashtable pedidos;
  13.  
  14.         static void Main(string[] args)
  15.         {
  16.         Program p = new Program();
  17.             int opc, c;
  18.  
  19.             do
  20.             {
  21.                 p.Mensaje("Seleccionar menu :");
  22.                 p.Mensaje("1.- Altas");
  23.                 p.Mensaje("2.- Cliente");
  24.                 p.Mensaje("3.- Salir");
  25.                 opc = Convert.ToInt16(Console.ReadLine());
  26.                 switch (opc)
  27.                 {
  28.                     case 1:
  29.                         p.Mensaje("¿Cuantas Mesas?");
  30.                         opc = Convert.ToInt16(Console.ReadLine());
  31.                         p.mesas = new Mesa[opc];
  32.                         for (int i = 0; i < opc; i++)
  33.                             p.mesas[i] = new Mesa(i + 1);
  34.                         p.Mensaje("¿Cuantos Platillos?");
  35.                         c = Convert.ToInt16(Console.ReadLine());
  36.                         p.platillos = new Platillo[c];
  37.                         for (int i = 0; i < c; i++)
  38.                             p.platillos[i] = new Platillo();
  39.                         p.AltaPlatillo();
  40.                         break;
  41.                     case 2:
  42.                         do
  43.                         {
  44.                             p.Mensaje("1.- Asignar Cliente a una Mesa");
  45.                             p.Mensaje("2.- Mostrar Informacion de la Mesa");
  46.                             p.Mensaje("3.- Pagar la Cuenta");
  47.                             p.Mensaje("4.- Regresar");
  48.                             c = Convert.ToInt16(Console.ReadLine());
  49.                             switch (c)
  50.                             {
  51.                                 case 1:
  52.                                     p.AsignarClienteMesa();
  53.                                     break;
  54.                                 case 2:
  55.                                     p.MostrarInformacionMesa();
  56.                                     break;
  57.                                 case 3:
  58.                                     break;
  59.                                 case 4:
  60.                                     break;
  61.                                 default:
  62.                                     break;
  63.                             }
  64.                         } while (c != 4);
  65.                         break;
  66.                     case 3:
  67.                         break;
  68.                     default:
  69.                         p.Mensaje("Opcion Invalida");
  70.                         break;
  71.                 }
  72.             } while (opc != 3);
  73.         }
  74.                    
  75.        
  76.                
  77.         public void AsignarClienteMesa()
  78.         {
  79.             bool agregado = false;
  80.             int n=0;
  81.             for(int x = 0; x < mesas.Length && !agregado; x++)
  82.                 if (mesas[x].Ocupada == false)
  83.                 {
  84.                     Cliente cl = new Cliente();
  85.                     Mensaje("Nombre del Cliente: ");
  86.                     cl.Nombre = Console.ReadLine();
  87.                     Mensaje("Numero de Personas: ");
  88.                    n = Convert.ToInt16(Console.ReadLine());
  89.  
  90.                     mesas[x].Cliente = cl;
  91.                     mesas[x].Ocupada = true;
  92.                     mesas[x].Nopersonas = n;
  93.                     agregado = true;
  94.                     n = x+1;
  95.                 }
  96.             if (agregado)
  97.             {
  98.                 LevantarPedido(n-1, mesas[n-1].Nopersonas);
  99.                 Mensaje("Cliente Asigando a la Mesa: " + n);
  100.             }
  101.             else
  102.                 Mensaje("No hay mesas Disponibles");
  103.         }
  104.  
  105.         public void AltaPlatillo()
  106.         {
  107.             bool agregado = false;
  108.             for(int x = 0; x < platillos.Length; x++)
  109.                 if (platillos != null)
  110.                 {
  111.                     Platillo pl = new Platillo();
  112.                     pl.Clave = (x + 1);
  113.                     Mensaje("Nombre del Platillo: ");
  114.                     pl.Descripcion = Console.ReadLine();
  115.                     Mensaje("Precio del Platillo: ");
  116.                     pl.Importe = Convert.ToDouble(Console.ReadLine());
  117.                     Mensaje("Duracion de Preparacion: ");
  118.                     pl.Duracion = Convert.ToInt16(Console.ReadLine());
  119.                     agregado = true;
  120.                 }
  121.  
  122.             if (agregado)
  123.                 Mensaje("El Platillo fue agregado");
  124.             else
  125.                 Mensaje("No hay mas espacio para agregar Platillos");
  126.         }
  127.  
  128.         public void MostrarInformacionMesa()
  129.         {
  130.             Mesa m;
  131.             for(int i = 0; i < mesas.Length; i++)
  132.             {
  133.                 m = mesas[i];
  134.                 Mensaje("No de Mesa: " + m.Nomesa + " - " + ((m.Ocupada) ? "Ocupada" : "Desocupada"));
  135.                 if (m.Ocupada)
  136.                 {
  137.                     Mensaje("Nombre del Cliente: " + m.Cliente.Nombre);
  138.                     Mensaje("No. de Personas: " + m.Nopersonas);
  139.                 }
  140.             }
  141.         }
  142.  
  143.         public void LevantarPedido(int mesa, int nopersonas)
  144.         {
  145.             //pedidos.Add(mesa, p);
  146.         }
  147.  
  148.         public void Mensaje(string msj)
  149.         {
  150.             Console.WriteLine(msj);
  151.         }
  152.     }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement