static string[] arrDatosCliente = new string[3];
static string[,] arrMenu = new string[3,3];
static string[,] arrOrden = new string[1, 2];
static void Main(string[] args)
private static void mostrarMenuInicial()
private static void menu()
arrMenu[0, 1] = "Pizza meatlover";
arrMenu[1, 1] = "Mega boom box";
arrMenu[2, 1] = "Pizza Gigante de 1 ingredientes + un complemento.";
Console.WriteLine("Bienvenido sistema de ordenes pizzajat");
Console.WriteLine("Menú del día");
PrintRow("id", "Pizza", "Precios$");
int cantidadMenu = arrMenu.GetLength(0);
for (int i = 0; i < cantidadMenu; i++)
string id = arrMenu[i, 0];
string producto = arrMenu[i, 1];
string precio = arrMenu[i, 2];
PrintRow(id, producto, precio);
private static void ordenar(ref string[,] arr)
int controlIteraciones = 0;
int contadorProductos = 0;
Console.WriteLine("Ingresar el id de la pizza a comprar:");
int id = Convert.ToInt32(Console.ReadLine());
if (id <= arrMenu.GetLength(0))
arr[contadorProductos, 0] = id.ToString();
Console.WriteLine("Ingresar la cantidad:");
cantidad = Convert.ToInt32(Console.ReadLine());
arr[contadorProductos, 1] = cantidad.ToString();
Console.WriteLine("La cantidad debe ser mayor a cero");
Console.WriteLine("Desea agregar algo más a esta orden: 1: Si 2: No");
int resp = Convert.ToInt32(Console.ReadLine());
string[,] arrAux = new string[arr.GetLength(0), arr.GetLength(1)];
arr = new string[arr.GetLength(0) + 1, arr.GetLength(1)];
for (int i = 0; i < arrAux.GetLength(0); i++)
arr[i, 0] = arrAux[i, 0];
arr[i, 1] = arrAux[i, 1];
controlIteraciones = resp;
Console.WriteLine("Por favor, seleccionar una operación válida.");
} while (controlIteraciones == 1);
Console.WriteLine("Ha ocrrido un error:" + ex.Message.ToString());
private static void datosCliente()
Console.WriteLine("Nombre del cliente: ");
string nombreCliente = Console.ReadLine();
Console.WriteLine("Teléfono: ");
string tel = Console.ReadLine();
bool opcionTipoPagoValida = false;
Console.WriteLine("Tipo de pago: 1:efectivo, 2:tarjeta");
tipoPago = Convert.ToInt32(Console.ReadLine());
if (tipoPago >= 1 && tipoPago <= 2)
opcionTipoPagoValida = true;
Console.WriteLine("Por favor, seleccionar una opcion de pago válida.");
} while (opcionTipoPagoValida == false);
arrDatosCliente[0] = nombreCliente;
arrDatosCliente[1] = tel;
arrDatosCliente[2] = tipoPago.ToString();
Console.WriteLine("Elija una opción: 1:Regresara menú 2:Salir");
int opcion = Convert.ToInt32(Console.ReadLine());
case 1:mostrarMenuInicial();
Console.WriteLine("Ha ocurrido un error: " + ex.Message.ToString());
private static void mostrarOrden()
string nombreCliente = arrDatosCliente[0];
string tel = arrDatosCliente[1];
string tipoPago = arrDatosCliente[2];
Console.WriteLine("Detalle de la orden");
Console.WriteLine("Cliente: " + nombreCliente + "Teléfono: " + tel + "Tipo de pago: " + tipoPago);
PrintRow("Id", "Producto", "Precio", "Cantidad", "Subtotal");
int cantidadProdectos = arrOrden.GetLength(0);
for (int i = 0; i < cantidadProdectos; i++)
int idProducto = Convert.ToInt32(arrOrden[i, 0]);
int cantidad = Convert.ToInt32(arrOrden[i, 1]);
string producto = arrMenu[idProducto - 1, 1];
double precioUnitario = Convert.ToDouble(arrMenu[idProducto - 1, 2]);
double totalProducto = 0;
if (Convert.ToInt32(tipoPago) == 1)
totalProducto = Math.Round(precioUnitario * cantidad, 2);
totalProducto = ((precioUnitario * cantidad));
totalProducto += Math.Round(totalProducto * 0.05, 2);
PrintRow(idProducto.ToString(), producto, precioUnitario.ToString(), cantidad.ToString(), totalProducto.ToString());
Console.WriteLine("Ha ocurrido un error: " + ex.Message.ToString());
static int tableWidth = 100;
Console.WriteLine(new string('-', tableWidth));
static void PrintRow(params string[] columns)
int width = (tableWidth - columns.Length) / columns.Length;
foreach (string column in columns)
row += AlignCentre(column, width) + "|";
static string AlignCentre(string text, int width)
text = text.Length > width ? text.Substring(0, width - 3) + "..." : text;
if (string.IsNullOrEmpty(text))
return new string(' ', width);
return text.PadRight(width - (width - text.Length) / 2).PadLeft(width);