-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
79 lines (66 loc) · 3.07 KB
/
Copy pathProgram.cs
File metadata and controls
79 lines (66 loc) · 3.07 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Linq;
namespace pr1
{
class Program : Pacient
{
static void Main(string[] args)
{
string again = "yes";
while (again == "yes")
{
List<Pacient> pacients = new List<Pacient>();
var summerList = new List<string>();
var springList = new List<string>();
Pacient pacient1 = new Pacient();
pacient1.FIO = "Леонель Меси";
pacient1.Day = 18;
pacient1.Month = 8;
pacient1.Year = 2005;
pacients.Add(pacient1);
Pacient pacient2 = new Pacient();
pacient2.FIO = "Аафва Аваафв";
pacient2.Day = 10;
pacient2.Month = 4;
pacient2.Year = 2003;
pacients.Add(pacient2);
Console.WriteLine("Нажмите 1 если хотите просмотреть данные о " + pacient1.FIO + " или 2 если хотите посмотреть информацию о " + pacient2.FIO);
int choosepacients = Convert.ToInt32(Console.ReadLine());
if (!string.IsNullOrEmpty(pacient1.FIO) && choosepacients == 1)
{
Console.WriteLine("Инициалы пациента:\t " + pacient1.FIO);
Console.WriteLine("Месяц рождения:\t\t " + pacient1.ToString());
Console.WriteLine("Возраст: \t\t " + pacient1.AgeResult(pacient1));
}
else if (!string.IsNullOrEmpty(pacient2.FIO) && choosepacients == 2)
{
Console.WriteLine("Инициалы пациента:\t " + pacient2.FIO);
Console.WriteLine("Месяц рождения:\t\t " + pacient2.ToString());
Console.WriteLine("Возраст: \t\t " + pacient2.AgeResult(pacient2));
}
Console.WriteLine("Нажмите на кнопку 1 если нужно вывести список весенных дат рождения или 2 если нужно вывести летние");
int r1 = Convert.ToInt32(Console.ReadLine());
if (r1 == 1)
{
var spring = pacients.Where(s => s.Year >= 1990 & s.Year <= 2005 & s.Month >= 3 & s.Month <= 5).OrderBy(s => s);
foreach (Pacient p in spring)
{
Console.WriteLine("Весенние даты рождения: " + p.DateOfBirth(p));
}
}
else if (r1 == 2)
{
var summer = pacients.Where(s => s.Month >= 6 & s.Month <= 8).OrderBy(s => s);
foreach (Pacient p2 in summer)
{
Console.WriteLine("Летние даты рождения: " + p2.DateOfBirth(p2));
}
}
Console.WriteLine("Вы хотите продолжить работу с программой? (yes/no)");
again = Console.ReadLine();
}
}
}
}