Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (46 loc) · 1.9 KB
/
Copy pathProgram.cs
File metadata and controls
56 lines (46 loc) · 1.9 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
using csharp_Exercise03_Orders;
using csharp_Exercise03_Orders.Entities;
using csharp_Exercise03_Orders.Entities.Enum;
using System;
using System.Globalization;
namespace Exercise03_Orders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter client data: ");
Console.Write("Name: ");
string nameClient = Console.ReadLine();
Console.Write("Email: ");
string email = Console.ReadLine();
Console.Write("Birth date (DD/MM/YYYY): ");
DateTime brithDate = DateTime.Parse(Console.ReadLine());
Console.WriteLine();
Console.WriteLine("Enter order data: ");
Console.Write("Status: ");
OrderStatus status = Enum.Parse<OrderStatus>(Console.ReadLine());
Client client = new Client(nameClient, email, brithDate);
Order order = new Order(DateTime.Now, status, client);
Console.WriteLine();
Console.Write("How many items to this order? ");
int n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.WriteLine();
Console.WriteLine($"Enter #{i} item data: ");
Console.Write("Product name: ");
string nameProduct = Console.ReadLine();
Console.Write("Product price: ");
double price = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
Console.Write("Quantify: ");
int quantify = int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
Product product = new Product(nameProduct, price);
OrderItem orderItem = new OrderItem(quantify, price, product);
order.AddItem(orderItem);
}
Console.WriteLine();
Console.WriteLine(order);
}
}
}