public void MakePerson(int age) { Person newPerson = new Person(); newPerson.Age = age; if (age % 2 == 0) { newPerson.Name = "John"; newPerson.Gender = Gender.male; } else { newPerson.Name = "Ann"; newPerson.Gender = Gender.female; } }
public void HelloAnotherPerson(Person person, double time) { if (time <= 12) { Console.WriteLine("\"Доброе утро, {0}!\", - сказал {1}", person.Name, Name); } else if (time > 12 && time <= 17) { Console.WriteLine("\"Добрый день, {0}!\", - сказал {1}", person.Name, Name); } else { Console.WriteLine("\"Добрый вечер, {0}!\", - сказал {1}", person.Name, Name); } }
static void Main(string[] args) { var office = new Office(); Person.CameEvent += office.OnCame; Person.LeftEvent += office.OnLeft; var john = new Person("Джон"); john.Came(10.05); var bill = new Person("Билл"); bill.Came(12.50); var hugo = new Person("Хьюго"); hugo.Came(17.10); john.Left(); bill.Left(); hugo.Left(); Console.ReadKey(); }
public void ByeAnotherPerson(Person person) { Console.WriteLine("\"До свидания, {0}!\", - сказал {1}", person.Name, Name); }