Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Collections;
- namespace Restaurant
- {
- class Program
- {
- public Mesa [] mesas;
- public Platillo[] platillos;
- public Hashtable pedidos;
- static void Main(string[] args)
- {
- Program p = new Program();
- int opc, c;
- do
- {
- p.Mensaje("Seleccionar menu :");
- p.Mensaje("1.- Altas");
- p.Mensaje("2.- Cliente");
- p.Mensaje("3.- Salir");
- opc = Convert.ToInt16(Console.ReadLine());
- switch (opc)
- {
- case 1:
- p.Mensaje("¿Cuantas Mesas?");
- opc = Convert.ToInt16(Console.ReadLine());
- p.mesas = new Mesa[opc];
- for (int i = 0; i < opc; i++)
- p.mesas[i] = new Mesa(i + 1);
- p.Mensaje("¿Cuantos Platillos?");
- c = Convert.ToInt16(Console.ReadLine());
- p.platillos = new Platillo[c];
- for (int i = 0; i < c; i++)
- p.platillos[i] = new Platillo();
- p.AltaPlatillo();
- break;
- case 2:
- do
- {
- p.Mensaje("1.- Asignar Cliente a una Mesa");
- p.Mensaje("2.- Mostrar Informacion de la Mesa");
- p.Mensaje("3.- Pagar la Cuenta");
- p.Mensaje("4.- Regresar");
- c = Convert.ToInt16(Console.ReadLine());
- switch (c)
- {
- case 1:
- p.AsignarClienteMesa();
- break;
- case 2:
- p.MostrarInformacionMesa();
- break;
- case 3:
- break;
- case 4:
- break;
- default:
- break;
- }
- } while (c != 4);
- break;
- case 3:
- break;
- default:
- p.Mensaje("Opcion Invalida");
- break;
- }
- } while (opc != 3);
- }
- public void AsignarClienteMesa()
- {
- bool agregado = false;
- int n=0;
- for(int x = 0; x < mesas.Length && !agregado; x++)
- if (mesas[x].Ocupada == false)
- {
- Cliente cl = new Cliente();
- Mensaje("Nombre del Cliente: ");
- cl.Nombre = Console.ReadLine();
- Mensaje("Numero de Personas: ");
- n = Convert.ToInt16(Console.ReadLine());
- mesas[x].Cliente = cl;
- mesas[x].Ocupada = true;
- mesas[x].Nopersonas = n;
- agregado = true;
- n = x+1;
- }
- if (agregado)
- {
- LevantarPedido(n-1, mesas[n-1].Nopersonas);
- Mensaje("Cliente Asigando a la Mesa: " + n);
- }
- else
- Mensaje("No hay mesas Disponibles");
- }
- public void AltaPlatillo()
- {
- bool agregado = false;
- for(int x = 0; x < platillos.Length; x++)
- if (platillos != null)
- {
- Platillo pl = new Platillo();
- pl.Clave = (x + 1);
- Mensaje("Nombre del Platillo: ");
- pl.Descripcion = Console.ReadLine();
- Mensaje("Precio del Platillo: ");
- pl.Importe = Convert.ToDouble(Console.ReadLine());
- Mensaje("Duracion de Preparacion: ");
- pl.Duracion = Convert.ToInt16(Console.ReadLine());
- agregado = true;
- }
- if (agregado)
- Mensaje("El Platillo fue agregado");
- else
- Mensaje("No hay mas espacio para agregar Platillos");
- }
- public void MostrarInformacionMesa()
- {
- Mesa m;
- for(int i = 0; i < mesas.Length; i++)
- {
- m = mesas[i];
- Mensaje("No de Mesa: " + m.Nomesa + " - " + ((m.Ocupada) ? "Ocupada" : "Desocupada"));
- if (m.Ocupada)
- {
- Mensaje("Nombre del Cliente: " + m.Cliente.Nombre);
- Mensaje("No. de Personas: " + m.Nopersonas);
- }
- }
- }
- public void LevantarPedido(int mesa, int nopersonas)
- {
- //pedidos.Add(mesa, p);
- }
- public void Mensaje(string msj)
- {
- Console.WriteLine(msj);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement