static void Main(string[] args) { Person person = new Person(); person.Firstname = "Kirsi"; person.Lastname = "Kernel"; person.Age = 35; person.Address = "Piippukatu 2"; person.Phonenumber = "02001215"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Jussi", "Konsoli", "D456"); teacher.Address = "Piippukatu1"; teacher.Age = 40; teacher.Phonenumber = "010-541256"; Console.WriteLine(teacher.ToString()); Student student = new Student("Juuso", "Jokio"); teacher.Address = "Piippukatu 66"; teacher.Age = 21; teacher.Phonenumber = "020-541256"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
public static void Main() { Person anyPerson = new Person("Pesho Goshev Toshev"); Console.WriteLine(anyPerson); anyPerson.Age = 27; Console.WriteLine(anyPerson); }
public static void Main() { Person ivan = new Person("Ivan", 22); Person petkan = new Person("Petkan"); Console.WriteLine(ivan); Console.WriteLine(petkan); }
private void create_btn_Click(object sender, EventArgs e) { Element el = new Element(); if (el.ShowDialog() == DialogResult.OK) { IPersonality ip; if (el.isStudent) { ip = new Person.Student() { Name = el.PersonName, Age = int.Parse(el.Age), TotalMark = int.Parse(el.TotalMark) }; } else { ip = new Person.Person() { Name = el.PersonName, Age = int.Parse(el.Age) }; } ip.propertyChanged += ShowProperty; band.Add(ip); listBox1.Items.Add(ip.ToString()); } }
static void Main() { Person a = new Person("aaa"); Person b = new Person("bbb", 22); Console.WriteLine(a.ToString()); Console.WriteLine(b.ToString()); }
static void Main() { Person me = new Person("Mou"); Console.WriteLine(me); Person meWithAge = new Person("Mou", 12); Console.WriteLine(meWithAge); }
static void Main(string[] args) { Person pesho = new Person("Pesho", 17); Person gosho = new Person("Gosho", 17, "*****@*****.**"); Console.WriteLine(pesho.ToString()); Console.WriteLine(gosho.ToString()); }
static void Main() { Person person1 = new Person("Pesho", 43); Console.WriteLine(person1); Person person2 = new Person("Ivan"); Console.WriteLine(person2); }
/* Create a class Person with two fields – name and age. Age can be left unspecified (may contain null value. Override ToString() to display the information of a person and if age is not specified – to say so. Write a program to test this functionality.*/ private static void Main() { var somePerson = new Person("Gosho"); var otherPerson = new Person("Pesho", 10); Console.WriteLine(somePerson); Console.WriteLine(otherPerson); }
static void Main(string[] args) { Person x = new Person("Ivna"); Console.WriteLine(x); Person y = new Person("Divna", 13); Console.WriteLine(y); }
static void Main() { Person p1 = new Person("Pesho", 24); Person p2 = new Person("Ivo"); Console.WriteLine(p1); Console.WriteLine(p2); }
static void Main(string[] args) { Person p = new Person("Ivan", 23); Console.WriteLine(p); Person i = new Person("Kiro", 25,"*****@*****.**"); Console.WriteLine(i); }
public void TestNewPersonIsVerwitwet() { Person.Person verwitwet = new Person.Person(); Assert.AreEqual(false, verwitwet.Ledig); Assert.AreEqual(false, verwitwet.Geschieden); Assert.AreEqual(false, verwitwet.Verheiratet); Assert.AreEqual(true, verwitwet.Verwitwet); }
public void TestNewPersonIsGeschieden() { Person.Person geschiedene = new Person.Person(); Assert.AreEqual(false, geschiedene.Ledig); Assert.AreEqual(true, geschiedene.Geschieden); Assert.AreEqual(false, geschiedene.Verheiratet); Assert.AreEqual(false, geschiedene.Verwitwet); }
static void Main() { Person person1 = new Person("Pesho", 20); Person person2 = new Person("Gosho"); Console.WriteLine(person1); Console.WriteLine(person2); }
public static void Main() { Person firstPerson = new Person("Harrison"); Person secondPerson = new Person("Johns", 55); Console.WriteLine(firstPerson.ToString()); Console.WriteLine(secondPerson.ToString()); }
public static void Main() { var eminem = new Person("Marshall Mathers", 42); var dmx = new Person("Earl Simmons"); Console.WriteLine(eminem); Console.WriteLine(dmx); }
static void Main(string[] args) { Person marin = new Person("Marin", 15); Person peter = new Person("Peter", null); Console.WriteLine(marin.ToString()); Console.WriteLine(peter.ToString()); }
static void Main(string[] args) { Person vanya = new Person("Vanya", 18); Person voldemort = new Person("Voldemort"); Console.WriteLine(vanya); Console.WriteLine(voldemort); }
static void Main(string[] args) { Person p1 = new Person("Niki", 24); Person p2 = new Person("Ivo"); Console.WriteLine(p1); Console.WriteLine(p2); }
public void TestNewPersonIsLedig() { Person.Person neuling = new Person.Person(); Assert.AreEqual(true, neuling.Ledig); Assert.AreEqual(false, neuling.Geschieden); Assert.AreEqual(false, neuling.Verheiratet); Assert.AreEqual(false, neuling.Verwitwet); }
public static void Person() { Person myPerson = new Person(); myPerson.Name = "Kaliningradskaya Carskaya"; Console.WriteLine(myPerson.ToString()); myPerson.Age = 10; Console.WriteLine(myPerson.ToString()); }
static void Main(string[] args) { Person newPerson = new Person("Ivo"); Person otherPerson = new Person("Alex", null); Person seconPerson = new Person("Ani", 24); Console.WriteLine(newPerson); Console.WriteLine(otherPerson); Console.WriteLine(seconPerson); }
static void Main(string[] args) { Person per = new Person("lala", 36); Person per1 = new Person("lala", null); Person per2 = new Person("fafa"); Console.WriteLine(per); Console.WriteLine(per1); Console.WriteLine(per2); }
public static void Main() { Person p1 = new Person("Ivan", 18, "*****@*****.**"); Person p2 = new Person("Ioana", 27); //Person p3 = new Person("Ivancho", 18, "Ivanchoabv.bg"); Person[] persons = { p1, p2 }; persons.ToList().ForEach(Console.WriteLine); }
static void Main() { Person somePerson = new Person("Pesho", 20); Person anotherPerson = new Person("Gosho"); Person oneMorePerson = new Person("Tosho", 33); Console.WriteLine(somePerson); Console.WriteLine(oneMorePerson); Console.WriteLine(anotherPerson); }
private static void Main(string[] args) { Person first = new Person("Ivan",32); Person second = new Person("Pesho",null); Console.WriteLine(first); Console.WriteLine(); Console.WriteLine(second); }
public void TestPersonLedig2Verheiratet2annuliert() { Person.Person neuling = new Person.Person(); neuling.heiraten(); neuling.annulieren(); Assert.AreEqual(true, neuling.Ledig); Assert.AreEqual(false, neuling.Geschieden); Assert.AreEqual(false, neuling.Verheiratet); Assert.AreEqual(false, neuling.Verwitwet); }
public void TestPersonledig2Verheiratet2Verwitvert() { Person.Person neuling = new Person.Person(); neuling.heiraten(); neuling.PartnerTod(); Assert.AreEqual(false, neuling.Ledig); Assert.AreEqual(false, neuling.Geschieden); Assert.AreEqual(false, neuling.Verheiratet); Assert.AreEqual(true, neuling.Verwitwet); }
public static void Main() { Person firstPerson = new Person("Georgi Georgiev", 36); Person secondPerson = new Person("Pesho Pesshev", null); Person thirdPerson = new Person("Joro Petrov"); Console.WriteLine(firstPerson); Console.WriteLine(secondPerson); Console.WriteLine(thirdPerson); }
static void Main(string[] args) { //test Person person1 = new Person("Pesho"); Person person2 = new Person("Gosho", 23); //print Console.WriteLine(person1); Console.WriteLine(person2); }
static void Main(string[] args) { Person.Person obj = new Person.Person(); Type t = obj.GetType(); Console.WriteLine("\nИнформация о типе:"); Console.WriteLine("Тип " + t.FullName + " унаследован от " + t.BaseType.FullName); Console.WriteLine("Пространство имен " + t.Namespace); Console.WriteLine("Находится в сборке " + t.AssemblyQualifiedName); Console.WriteLine("\nКонструкторы:"); foreach (var x in t.GetConstructors()) { Console.WriteLine(x); } Console.WriteLine("\nМетоды:"); foreach (var x in t.GetMethods()) { Console.WriteLine(x); } Console.WriteLine("\nСвойства:"); foreach (var x in t.GetProperties()) { Console.WriteLine(x); } Console.WriteLine("\nПоля данных (public):"); foreach (var x in t.GetFields()) { Console.WriteLine(x); } Type t2 = typeof(Person.Person); Console.WriteLine("\nВызов метода:"); Person.Person Lera = (Person.Person)t.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { }); object[] parameters = new object[] { 5, 5 }; object Result = t.InvokeMember("Study", BindingFlags.InvokeMethod, null, Lera, parameters); Console.WriteLine("Успеваемость: {0}", Result); Console.WriteLine("\nPerson реализует IComparable -> " + t.GetInterfaces().Contains(typeof(IComparable))); Type a = typeof(Person.Person); Console.WriteLine("\nСвойства, помеченные атрибутом:"); foreach (var x in a.GetProperties()) { object at; if (GetPropertyAttribute(x, typeof(NewAttribute), out at)) { NewAttribute attr = at as NewAttribute; Console.WriteLine(x.Name + " - " + attr.abc); } } Console.ReadKey(); }
static void Main() { //Initialize some people Person person1 = new Person("Ivan Ivanov", 15); Person person2 = new Person("Dragan Draganov", 35); Person person3 = new Person("Petkan Petkanov"); Console.WriteLine(person1); Console.WriteLine(person2); Console.WriteLine(person3); }
static void Main() { Console.ForegroundColor = ConsoleColor.Yellow; Person pesho = new Person("Pesho Peshov", 98); Console.WriteLine(pesho); Person ivan = new Person("Ivan Ivanov"); Console.WriteLine(ivan); Console.ForegroundColor = ConsoleColor.White; }
static void Main() { //creating people var personWithAge = new Person("John Doe", 24); var personWithoutAge = new Person("Jane Doe", null); //printing people Console.WriteLine("People: "); Console.WriteLine(new string('-', 30)); Console.WriteLine(personWithAge.ToString()); Console.WriteLine(personWithoutAge.ToString()); }
static void Main(string[] args) { Person p1 = new Person(); Person p2 = new Person(); bool p1Married; bool p2Married; System.Console.WriteLine("Enter first person's information"); System.Console.WriteLine("What is the first name?"); p1.FirstName = System.Console.ReadLine(); System.Console.WriteLine("What is the last name?"); p1.LastName = System.Console.ReadLine(); System.Console.WriteLine("What is the Age?"); p1.Age = Convert.ToInt32(System.Console.ReadLine()); System.Console.WriteLine("Is this person married?"); p1Married = Convert.ToBoolean(System.Console.ReadLine()); System.Console.WriteLine("What is the first name of spouse?"); p1.Spouse = new Person(); Person.SumOfAllAges = p1.Age; p1.Spouse.FirstName = System.Console.ReadLine(); p1.Spouse.LastName = p1.LastName; System.Console.WriteLine("What is the Age of spouse?"); p1.Spouse.Age = Convert.ToInt32(System.Console.ReadLine()); Person.SumOfAllAges = Person.SumOfAllAges + p1.Spouse.Age; System.Console.WriteLine("Enter second person's information"); System.Console.WriteLine("What is the first name?"); p2.FirstName = System.Console.ReadLine(); System.Console.WriteLine("What is the last name?"); p2.LastName = System.Console.ReadLine(); System.Console.WriteLine("What is the Age?"); p2.Age = Convert.ToInt32(System.Console.ReadLine()); System.Console.WriteLine("Is this person married?"); p2Married = Convert.ToBoolean(System.Console.ReadLine()); System.Console.WriteLine("What is the first name of spouse?"); p2.Spouse = new Person(); Person.SumOfAllAges = Person.SumOfAllAges + p2.Age; p2.Spouse.FirstName = System.Console.ReadLine(); p2.Spouse.LastName = p2.LastName; System.Console.WriteLine("What is the Age of spouse?"); p2.Spouse.Age = Convert.ToInt32(System.Console.ReadLine()); Person.SumOfAllAges = Person.SumOfAllAges + p2.Spouse.Age; p1.PrintNameAndAge(); p1.Spouse.PrintNameAndAge(); p2.PrintNameAndAge(); p2.Spouse.PrintNameAndAge(); System.Console.WriteLine("Average Age: " + Person.SumOfAllAges / 4); System.Console.WriteLine("Press any key to exit"); System.Console.Read(); }
//public static List<Person> GetMarried(Person p1, Person p2) public static List<Person> operator +(Person p1, Person p2) { List<Person> people = new List<Person>(); people.Add(p1); people.Add(p2); for (int i = 0; i < 11; i++) { Person child = new Person(); child.Name = p1.Name + "&" + p2.Name + "'s child"; people.Add(child); } return people; }
static void Main(string[] args) { Maths mathStuff = new Maths(); Job.Job job1 = new Job.Job("Programmer", 420.69); Person.Person person1 = new Person.Person("Uvuvwevwevwe Onyetenyevwe Ugwemuhwem Osas", 69, job1); int idk = 1; while (idk < 10) { Console.WriteLine(idk + ". " + person1.name + ", " + person1.age + ", " + person1.job.jobName + ", he earns " + person1.job.jobSalary + "$"); idk++; } Console.WriteLine(mathStuff.Plus("4", "6")); Console.WriteLine(mathStuff.Minus("15", "5")); Console.WriteLine(mathStuff.Multiply("2", "5")); Console.WriteLine(mathStuff.Divide("50", "5")); }