Exemplo n.º 1
0
        static void Main(string[] args)
        {

            Person p1 = new Person();
            Person p2 = new Person();

            p1.CollectData("p1");      
            p1.CollectDataSpouse();                 
            p2.CollectData("p2");                                  
            p2.CollectDataSpouse();

            Utilities.printHeader();
            
            p1.PrintNameAndAge();
            if (p1.Spouse != null) { p1.Spouse.PrintNameAndAge(); }            
            p2.PrintNameAndAge();
            if (p2.Spouse != null) { p2.Spouse.PrintNameAndAge(); }

            System.Console.WriteLine("");
            System.Console.WriteLine("Average Age: " + Person.GetAverageAge());                            
            System.Console.ReadKey();

        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Collect.Greeting();

            Person entry1 = new Person();
            Person.Count++;
            entry1.CollectData();

            Person.newEntry();

            Person entry2 = new Person();
            Person.Count++;
            entry2.CollectData();

            Person.newEntry();

            Person entry3 = new Person();
            Person.Count++;
            entry3.CollectData();

            System.Console.WriteLine("Thank you. Press any key to display results...");
            System.Console.ReadKey();
            System.Console.Clear();

            System.Console.WriteLine("Data for Person #1:");
            entry1.PrintData();
            System.Console.WriteLine("Data for Person #2:");
            entry2.PrintData();
            System.Console.WriteLine("Data for Person #3:");
            entry3.PrintData();

            System.Console.WriteLine("Donnie asked for average age, but I have a question about it and he didn't call me because he was watching a movie.\n");

            System.Console.WriteLine("Press any key to exit... ");
            System.Console.ReadKey();
        }