public bool IsThisAdultBoring(Adult adult)
 {
     Random rand = new Random(1);
     int boringMeter = rand.Next(100);
     if (boringMeter <= 50)
         return false;
     else
         return true;
 }
 static void Main(string[] args)
 {
     Adult adult1 = new Adult("male");
     Adult adult2 = new Adult("female");
     Console.WriteLine(adult1.IsThisAdultBoring(adult1));
     Console.WriteLine(adult2.IsThisAdultBoring(adult2));
     Child child =  adult1.HaveAChild(adult1, adult2);
     child.CreateToy(10, "green");
     child.DoStuff();
     adult1.DoStuff();
 }
Example #3
0
        static void Main(string[] args)
        {
            Adult adult1 = new Adult("male");
            Adult adult2 = new Adult("female");

            Console.WriteLine(adult1.IsThisAdultBoring(adult1));
            Console.WriteLine(adult2.IsThisAdultBoring(adult2));
            Child child = adult1.HaveAChild(adult1, adult2);

            child.CreateToy(10, "green");
            child.DoStuff();
            adult1.DoStuff();
        }
 public Child HaveAChild(Adult a,Adult b)
 {
     if((a.Gender=="Male"||a.Gender=="MALE"||a.Gender=="male")&&(b.Gender=="MALE"||b.Gender=="male"||b.Gender=="Male"))
     {
         Console.WriteLine("Not possible for two adults of the same gender to have a child");
     }
     else if((a.Gender == "Female" || a.Gender == "FEMALE" || a.Gender == "female") && (b.Gender == "FEMALE" || b.Gender == "female" || b.Gender == "Female"))
     {
         Console.WriteLine("Not possible for two adults of the same gender to have a child");
     }
     Child newChild = new Child("female");
     return newChild;
 }
Example #5
0
        public Child HaveAChild(Adult a, Adult b)
        {
            if ((a.Gender == "Male" || a.Gender == "MALE" || a.Gender == "male") && (b.Gender == "MALE" || b.Gender == "male" || b.Gender == "Male"))
            {
                Console.WriteLine("Not possible for two adults of the same gender to have a child");
            }
            else if ((a.Gender == "Female" || a.Gender == "FEMALE" || a.Gender == "female") && (b.Gender == "FEMALE" || b.Gender == "female" || b.Gender == "Female"))
            {
                Console.WriteLine("Not possible for two adults of the same gender to have a child");
            }
            Child newChild = new Child("female");

            return(newChild);
        }
Example #6
0
        public bool IsThisAdultBoring(Adult adult)
        {
            Random rand        = new Random(1);
            int    boringMeter = rand.Next(100);

            if (boringMeter <= 50)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            Toy toy1 = new Toy("Kolicka", "Sinq", "10cm");
            Toy toy2 = new Toy("Kamionche", "Zeleno", "20cm");
            Child child1 = new Child("Ivan", "Male", new[] { toy1, toy2});
            Toy toy3 = new Toy("Barbi", "Rozovo", "15cm");
            Child child2 = new Child("Mariq", "Female", toy3);
            Child child3 = new Child("Georgi", "Male");

            Adult adult1 = new Adult("Petur", "Male", new[] { child1, child2 });
            Adult adult2 = new Adult("Katq", "Female", new[] { child3 });
            Adult adult3 = new Adult("Martin", "Male");

            Console.WriteLine(adult1.ToString());
            Console.WriteLine();
            Console.WriteLine(adult2.ToString());
            Console.WriteLine();
            Console.WriteLine(adult3.ToString());

            Console.ReadKey();
        }