-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (47 loc) · 1.67 KB
/
Program.cs
File metadata and controls
57 lines (47 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using Accounting;
class Program
{
static Product[] Catalog = {
new Product("🐟 Pescado (kg)", 100, 1),
new Product("🐟 Pescado (kg)", 100, 10),
new Product("🐔 Pollo (kg)", 150, 1),
new Product("🐔 Pollo (kg)", 150, 5),
new Product("🥚 Huevos (unidades)", 10, 1),
new Product("🥚 Huevos (unidades)", 10, 30),
};
static void Main()
{
Cart cart = new Cart();
while (true)
{
Console.Clear();
System.Console.ForegroundColor = ConsoleColor.DarkBlue;
System.Console.WriteLine("💝 Catálogo");
System.Console.ForegroundColor = ConsoleColor.Black;
for (int i = 0; i < Catalog.Length; i++)
{
System.Console.WriteLine($"{i+1}: {Catalog[i]}");
}
System.Console.ForegroundColor = ConsoleColor.DarkGreen;
System.Console.WriteLine("\n\n🛒 Carrito - ${0}", cart.TotalCost());
System.Console.ForegroundColor = ConsoleColor.Black;
foreach (var item in cart.Products())
{
System.Console.WriteLine(item);
}
System.Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("\n\nAgregar producto: ");
try
{
int index = int.Parse(Console.ReadLine());
cart.Add(Catalog[index-1]);
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
Thread.Sleep(1000);
continue;
}
}
}
}