static void Main(string[] args) { // instantiate 3 persons (2) Person p1 = new Person("Syed", "Razvi", DateTime.Parse("08-08-1988"), 165); Person p2 = new Person("Brian", "Adams", DateTime.Parse("10-10-1970"), 180); Person p3 = new Person("Tony", "Stark", DateTime.Parse("12-12-1975"), 175); Console.WriteLine(); // (Task 1.2.1) Console.WriteLine("Full Name is " + p1.GetFullName()); //(1.2.1) Console.WriteLine("and ID: " + p1.id); Console.WriteLine(); // (Task 1.2.2) Console.WriteLine("Full Name is " + p2.GetFullName() + " and Height Difference from other person is " + p1.GetHeightDifference(p2) + " cm."); Console.WriteLine(); // (Task 2) // Person 1 Console.WriteLine("First Person Fullname: " + p1.GetFullName()); Console.WriteLine("First Person Height is " + p1.height + " cm."); Console.WriteLine(); // Person 2 Console.WriteLine("Second Person Fullname: " + p2.GetFullName()); Console.WriteLine("Second Person Height Difference from First Person is " + p2.GetHeightDifference(p1) + " cm."); Console.WriteLine(); // Person 3 Console.WriteLine("Third Person Fullname: " + p3.GetFullName()); Console.WriteLine("Third Person Height Difference from First Person is " + p3.GetHeightDifference(p1) + " cm."); Console.WriteLine(); p1.AddSubject("JAVASCRIPT", 2019); p1.AddSubject("CSHARP", 2020); p1.AddSubject("PROJECT MANAGEMENT", 2021); Console.WriteLine(p1.ShowSubject()); }
public static void Main(string[] args) { Subject Sub1 = new Subject(); Subject Sub2 = new Subject("English", 2020); Subject Sub3 = new Subject("Science", 2019); Subject Sub4 = new Subject("P.E.", 2018); List <Subject> SubjectList1 = new List <Subject> (); SubjectList1.Add(Sub1); SubjectList1.Add(Sub2); SubjectList1.Add(Sub3); List <Subject> SubjectList2 = new List <Subject> (); SubjectList2.Add(Sub1); SubjectList2.Add(Sub4); Person p1 = new Person(); Person p2 = new Person("Jason", "Momoa", "1984/08/30", 193, 4128, SubjectList1); Person p3 = new Person(); p3.Firstname = "Chopper"; p3.Surname = "Read"; p3.DOB = "1966/01/02"; p3.Height = 188; p3.SubjectList = SubjectList2; // p1.PrintAllInfo (); p1.GetFullName(); if (p1.Height > p2.Height) { Console.WriteLine("I am " + (p1.Height - p2.Height) + "cm's taller than " + p2.Firstname + ","); } else { Console.WriteLine("I am " + (p2.Height - p1.Height) + "cm's shorter than " + p2.Firstname + ","); } if (p1.Height > p3.Height) { Console.WriteLine("and I am " + (p1.Height - p3.Height) + "cm's taller than " + p3.Firstname); } else { Console.WriteLine("and I am " + (p3.Height - p1.Height) + "cm's shorter than " + p3.Firstname); } // p1.PrintSubjects (); p1.Addnewsubject(Sub1); // p2.PrintAllInfo (); p2.GetFullName(); if (p2.Height > p1.Height) { Console.WriteLine("I am " + (p2.Height - p1.Height) + "cm's taller than " + p1.Firstname + ","); } else { Console.WriteLine("I am " + (p1.Height - p2.Height) + "cm's shorter than " + p1.Firstname + ","); } if (p2.Height > p3.Height) { Console.WriteLine("and I am " + (p2.Height - p3.Height) + "cm's taller than " + p3.Firstname); } else { Console.WriteLine("and I am " + (p3.Height - p2.Height) + "cm's shorter than " + p3.Firstname); } p2.PrintSubjects(); // p3.PrintAllInfo (); p3.GetFullName(); if (p3.Height > p1.Height) { Console.WriteLine("I am " + (p3.Height - p1.Height) + "cm's taller than " + p1.Firstname + ","); } else { Console.WriteLine("I am " + (p1.Height - p3.Height) + "cm's shorter than " + p1.Firstname + ","); } if (p3.Height > p2.Height) { Console.WriteLine("and I am " + (p3.Height - p2.Height) + "cm's taller than " + p2.Firstname); } else { Console.WriteLine("and I am " + (p2.Height - p3.Height) + "cm's shorter than " + p2.Firstname); } // p3.PrintSubjects (); p3.Addnewsubject(Sub2); }