コード例 #1
0
        public static void Main()
        {
            Camera      pentax   = new Camera("Pentax");
            WaterPistol pistol   = new WaterPistol("Supersoaker");
            LaserGun    laserGun = new LaserGun("Acme");

            Hunter nish = new Hunter("Nish", "Mandal", pentax);

            Console.WriteLine(nish.Shoot());

            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());

            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());

            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
        }
コード例 #2
0
        public static void Main()
        {
            LaserGun    gun1 = new LaserGun("Cod");
            LaserGun    gun2 = new LaserGun("WorldWarZ");
            WaterPistol gun3 = new WaterPistol("Supersoaker");
            Camera      gun4 = new Camera("Polaroid");
            Camera      gun5 = new Camera("Nikon");

            Hunter hunter1 = new Hunter("Vinay", "Patel", gun1);
            Hunter hunter2 = new Hunter("Vinay", "Patel", gun3);
            Hunter hunter3 = new Hunter("Vinay", "Patel", gun5);

            List <IShootable> Guns = new List <IShootable>();

            Guns.Add(gun1);
            Guns.Add(gun2);
            Guns.Add(gun3);
            Guns.Add(gun4);
            Guns.Add(gun5);
            Guns.Add(hunter1);
            Guns.Add(hunter2);
            Guns.Add(hunter3);
            foreach (var item in Guns)
            {
                Console.WriteLine(item.Shoot());
            }

            Console.WriteLine("");
            Camera      pentax   = new Camera("Pentax");
            WaterPistol pistol   = new WaterPistol("Supersoaker");
            LaserGun    laserGun = new LaserGun("Acme");
            Hunter      nish     = new Hunter("Nish", "Mandal", pentax);

            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
        }
コード例 #3
0
        static void Main(string[] args)
        {
            //instantiating two objects from the Person class
            //Person bruno = new Person("Bruno", "Silva");
            //bruno.Age = 23;
            //Console.WriteLine($"Bruno is {bruno.Age}");
            ////Console.WriteLine(bruno.GetFullName());

            ////Person nish = new Person("Nish", "French");
            ////Console.WriteLine(bruno.GetFullName

            ////overloading constructor instance
            ////Person luis = new Person("Luis", "Wolton", 23);
            ////Console.WriteLine(luis.Age);

            ////structs
            //var s1 = new Point3D() { x = 1, y = 2, z = 3 };

            //Person john = new Person("John", "Jones") { Age = 20 };
            //Point3D pt3d = new Point3D(5, 8, 2);

            //DemoMethod(pt3d, john);

            //Hunter bruno = new Hunter("Bruno", "Silva", "nikon") { Age = 23 };
            //Console.WriteLine(bruno.Age);
            //Console.WriteLine(bruno.Shoot());

            //default inherited construction
            //Hunter bruno2 = new Hunter();
            //Console.WriteLine(bruno2.Age);
            //Console.WriteLine(bruno2.Shoot());


            //create a list of objects
            //Person bruno1 = new Person("Bruno", "Silva") { Age = 23 };
            //Hunter nish = new Hunter("Nish", "French", "nikon") ;
            //MonsterHunter luis = new MonsterHunter("Luis", "Wolton", "nikon", "fists");

            //var safariList = new List<object>();
            //safariList.Add(bruno1);
            //safariList.Add(nish);
            //safariList.Add(luis);

            //foreach(var obj in safariList)
            //{
            //    Console.WriteLine(obj.ToString());
            //}

            //Airplane air = new Airplane(200, 100, "JetRUs") { NumPassengers = 150 };
            //air.Ascend(500);
            //Console.WriteLine(air.Move(3));
            //Console.WriteLine(air);
            //air.Descend(200);
            //Console.WriteLine(air.Move());
            //air.Move();
            //Console.WriteLine(air);


            //working with Polymorphism
            //var bruno = new Person("Bruno", "Silva");
            //var boeing = new Airplane(400, 200, "Boeing");
            //var v1 = new Vehicle(12, 20);
            //var phil = new Hunter("Phil", "Anderson", "Pentax");

            ////make a list that only contains objects that use IMovable methods
            //var moveObj = new List<IMovable>()
            //{
            //    new Person("Chen", "Shan"),
            //    new Airplane(400, 200, "RyanAir"),
            //    new Vehicle(6, 10),
            //    new Hunter("Croc", "Dundee", "Nikon")
            //};

            //Console.WriteLine();
            //Console.WriteLine("Moving objects");
            //foreach(var item in moveObj)
            //{
            //    Console.WriteLine(item.Move(3));
            //}

            //var gameObject = new List<Object>()
            //{
            //    bruno,
            //    boeing,
            //    v1,
            //    phil
            //};

            //foreach(var item in gameObject)
            //{
            //    Console.WriteLine(item);
            //}

            //SpartaWrite(phil);
            //SpartaWrite(bruno);



            //public static void SpartaWrite(object obj)
            //{

            //    Console.WriteLine(obj);
            //    if(obj is Hunter)
            //    {
            //        var HunterObj = (Hunter)obj;
            //        Console.WriteLine(HunterObj.Shoot());
            //    }
            //}

            //Polymorphism homework tast, using interface and inheritance

            Camera      pentax   = new Camera("Pentax");
            WaterPistol pistol   = new WaterPistol("SuperSoaker");
            LaserGun    laserGun = new LaserGun("Acme");
            Hunter      nish     = new Hunter("Nish", "Mandal", pentax);

            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: SullyM14/SafariPark
        static void Main(string[] args)
        {
            //Person cathy = new Person("Cathy", "French");
            //Console.WriteLine(cathy.GetFullName());
            //Person nish;
            //nish = new Person("Nish", "Mandal");
            //Console.WriteLine(nish.GetFullName());
            //cathy.Age = 22;
            //Console.WriteLine($"Cathy is {cathy.Age}");
            //cathy.Age = -3;
            //Console.WriteLine($"Cathy is {cathy.Age}");

            //Hunter h = new Hunter("Marion", "Jones", "Leica") { Age = 32 };
            //Console.WriteLine(h.Age);
            //Console.WriteLine(h.Shoot());

            //Hunter h2 = new Hunter();
            //Console.WriteLine(h2.Shoot());

            //var h3 = new Hunter("Marion", "Jones", "Leica") { Age = 32 };
            //Console.WriteLine($"h Equals h3? {h.Equals(h3)}");
            //Console.WriteLine($"h HashCode: {h.GetHashCode()}");
            //Console.WriteLine($"h Type: {h.GetType()}");
            //Console.WriteLine($"h ToString: {h.ToString()}");
            //Console.WriteLine($"h:{h}");

            //Airplane a = new Airplane(200, 100, "JetsRUs") { NumPassengers = 150 };
            //a.Ascend(500);
            //Console.WriteLine(a.Move(3));
            //Console.WriteLine(a);
            //a.Descend(200);
            //Console.WriteLine(a.Move());
            //a.Move();
            //Console.WriteLine(a);

            //List<Object> gameObjects = new List<Object>()
            //{
            //    new Person("Cathy","French"),
            //new Airplane(400, 200, "Booing"),
            //new Vehicle(12,20),
            //new Hunter("Henry","Hodgkins","Pentax")
            //};
            //foreach(var gameObj in gameObjects)
            //{
            //    SaprtaWrite(gameObj);
            //}


            //List<IMovable> gameInterfaces = new List<IMovable>()
            //{
            //new Person("Cathy","French"),
            //new Airplane(400, 200, "Booing"),
            //new Vehicle(12,20),
            //new Hunter("Henry","Hodgkins","Pentax")
            //};
            //foreach (var gameInterface in gameInterfaces)
            //{
            //    Console.WriteLine(gameInterface.Move());
            //    Console.WriteLine(gameInterface.Move(10));
            //    //Console.WriteLine(gameInterface);
            //}

            //List<IShootable> gameWeapons = new List<IShootable>()
            //{
            //new LaserGun("Laser Gun"),
            //new WaterPistol("Water Pistol"),
            //new Hunter("Henry","Hodgkins",new Camera("Kodak")),
            //new Camera("Pentax")
            //};
            //foreach (var gameWeapon in gameWeapons)
            //{
            //    Console.WriteLine(gameWeapon.Shoot());
            //    //Console.WriteLine(gameInterface);
            //}

            Camera      pentax   = new Camera("Pentax");
            WaterPistol pistol   = new WaterPistol("Supersoaker");
            LaserGun    laserGun = new LaserGun("Acme");
            Hunter      nish     = new Hunter("Nish", "Mandal", pentax);
            Hunter      sully    = new Hunter("Sully", "Miah", pistol);

            Console.WriteLine(sully.Shoot());
            Console.WriteLine(nish.Shoot());
            nish.Shooter  = pistol;
            sully.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            Console.WriteLine(sully.Shoot());
            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
        }
コード例 #5
0
        static void Main(string[] args)
        {
            //Person cathy = new Person("Cathy", "French");
            //cathy.Age = 20;

            //Console.WriteLine(cathy.GetFullName());

            //Person nish;
            //nish = new Person("Nish", "Mandal") { Age = 30 };       //Age is an object initialiser
            //Console.WriteLine(nish.GetFullName());

            //Person Jino = new Person("Jino", "Bimpa") { Age = 20 };
            //Point3D pt3D = new Point3D(5, 8, 2);

            //DemoMethod(pt3D, Jino);

            //Hunter lauren = new Hunter("Lauren", "Pang", "Leica") { Age = 20 };
            //Console.WriteLine(lauren.Age);
            //Console.WriteLine(lauren.Shoot());
            //Console.WriteLine(lauren.GetFullName());

            //Hunter h = new Hunter();
            //Console.WriteLine(h.Shoot());

            //var kam = new Hunter("Kam", "Sohal", "Nikon") { Age = 25 };
            //Console.WriteLine($"Kam Equals Lauren? {kam.Equals(lauren)}");
            //Console.WriteLine($"Kam HashCode: {kam.GetHashCode()}");
            //Console.WriteLine($"Kam Type: {kam.GetType()}");
            //Console.WriteLine($"Kam ToString: {kam.ToString()}");

            //Airplane a = new Airplane(200, 100, "JetsRUs") { NumPassengers = 150 };
            //a.Ascend(500);
            //Console.WriteLine(a.Move(3));
            //Console.WriteLine(a);
            //a.Descend(200);
            //Console.WriteLine(a.Move());
            //a.Move();
            //Console.WriteLine(a);

            //var dom = new Hunter("Dom", "Newell", "Kodak");
            //var geoff = new Hunted("Geoff", "Jefferson", 3);

            //Console.WriteLine(dom.Shoot(geoff));

            //var nish = new Hunter("Nish", "Mandal") { Age = 30 };

            //SpartaWrite(nish, geoff);

            //List<object> gameObjects = new List<object>()
            //{
            //    new Person ("Cathy", "French"),
            //    new Airplane(400, 100, "Vorgon"),
            //    nish,
            //    new Vehicle(12, 40)
            //};

            //foreach(var gameObj in gameObjects)
            //{
            //    Console.WriteLine(gameObj.ToString());
            //}

            //var movingObj = new List<IMovable>()
            //{
            //    new Vehicle(),
            //    new Person(),
            //    new Airplane(),
            //    new Hunter(),
            //    new Hunted(),
            //    new Person(),
            //    new Airplane(),
            //    new Hunter()
            //};

            //foreach (var item in movingObj)
            //{
            //    Console.WriteLine(item.Move());
            //}

            //var shooties = new List<IShootable>()
            //{
            //    new WaterPistol("Nerf"),
            //    new LaserGun("ACME"),
            //    new WaterPistol("Super Soaker"),
            //    new LaserGun("DeathLazerz"),
            //    new Hunter(),
            //    new Hunter(),
            //    new Camera("Pentax")
            //};

            //foreach (var item in shooties)
            //{
            //    Console.WriteLine(item.Shoot());
            //}

            Console.WriteLine("Polymorphic Shootout\n\n");

            Camera      pentax   = new Camera("Pentax", 0);
            WaterPistol pistol   = new WaterPistol("SuperSoaker", 1);
            LaserGun    laserGun = new LaserGun("Acme", 2);
            SpaceGun    space    = new SpaceGun("Martian", 3);
            Hunter      dom      = new Hunter("Dom", "Newell", pistol, 10);
            Hunter      geoff    = new Hunter("Geoff", "Jefferson", pistol, 10);

            var nextTurn     = new Random();
            var weaponChange = new Random();


            while (dom.Health > 0 && geoff.Health > 0)
            {
                if (nextTurn.Next(2) == 1)
                {
                    switch (weaponChange.Next(4))
                    {
                    case 0:
                        dom.Shooter = laserGun;
                        break;

                    case 1:
                        dom.Shooter = pistol;
                        break;

                    case 2:
                        dom.Shooter = space;
                        break;

                    default:
                        dom.Shooter = pentax;
                        break;
                    }
                    Console.WriteLine(dom.Shoot(geoff, dom) + "\n");
                }
                else
                {
                    switch (weaponChange.Next(4))
                    {
                    case 0:
                        geoff.Shooter = laserGun;
                        break;

                    case 1:
                        geoff.Shooter = pistol;
                        break;

                    case 2:
                        geoff.Shooter = space;
                        break;

                    default:
                        geoff.Shooter = pentax;
                        break;
                    }
                    Console.WriteLine(geoff.Shoot(dom, geoff) + "\n");
                }
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Point3D     hunterPosition = new Point3D(2, 0, 1);
            Bow         bow            = new Bow("Wood", 3);
            Camera      pentax         = new Camera("Lego");
            WaterPistol pistol         = new WaterPistol("Nerf");
            LaserGun    laserGun       = new LaserGun("project3005");
            Hunter      tera           = new Hunter("Tera", "Sm", hunterPosition, pistol);

            Console.WriteLine(tera.Shoot());
            tera.Shootable = pentax;
            Console.WriteLine(tera.Shoot());
            tera.Shootable = bow;
            Console.WriteLine(tera.Shoot());
            tera.Shootable = laserGun;
            Console.WriteLine(tera.Shoot());
            tera.Shootable = bow;
            Console.WriteLine(tera.Shoot());

            //List<IMoveable> Iobject = new List<IMoveable>()
            //{
            //    new Person("Neil","Neil"),
            //    new Vehicle()
            //};


            //foreach (var Iobj in Iobject)
            //{
            //    Console.WriteLine(Iobj.Move());
            //    Console.WriteLine(Iobj.Move(1));
            //}

            Point3D tigerPosition = new Point3D(4, 0, 4);
            // Point3D hunterPosition = new Point3D(2, 0, 1);

            Tiger  tiger  = new Tiger(Animals.animalType.aerial, 20, 40, tigerPosition, 3);
            Hunter hunter = new Hunter("Jino", "Biba", hunterPosition, bow);

            Point3D tigerNewPosition = new Point3D(3, 0, 1);


            string input = "";

            Console.WriteLine("Hi Tiger, There is a hunter nearby! \n");
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
            Console.WriteLine("");
            while (true)
            {
                Console.WriteLine("Press 'i' to get the hunters info");
                Console.WriteLine("Press 'a' to Attack the hunter");
                Console.WriteLine("Press 'm' to Move closer to the hunter");
                Console.WriteLine("Press 'e' to Run\n");
                Console.WriteLine($"Your Position On Safari is X: {tiger.Position.X} Y: {tiger.Position.Y} Z: {tiger.Position.Z}\n");

                input = Console.ReadLine();
                switch (input)
                {
                case "i":
                    Console.WriteLine($"Name: {hunter.GetFullName()}, Health: {hunter.Health}," +
                                      $" Position On Safari X: {hunter.Position.X} Y: {hunter.Position.Y}, Z: {hunter.Position.Z}\n");
                    break;

                case "a":
                    tiger.Attack(hunter);

                    if (hunter.Health > 0)
                    {
                        Console.WriteLine($"{hunter.Shoot()}\n");
                        tiger.Health -= bow.Damage;
                        Console.WriteLine($"The Hunter Shot you with a Bow, and inflicted {bow.Damage} Damage\nYour Hp now Is {tiger.Health}\n");
                    }
                    break;

                case "m":
                    tiger.Move(tigerNewPosition);
                    Console.WriteLine("You moved Closer, Try Attacking! \n");
                    break;

                case "e":
                    if (hunter.Health <= 0)
                    {
                        Console.WriteLine("Thank you for taking down the hunters. \nSee you next time!");
                    }
                    else
                    {
                        Console.WriteLine("You Chose to Run Away. Nice move :p");
                    }

                    Environment.Exit(0);

                    break;
                }
            }

            /////
            // tiger.Attack(hunter);

            //Point3D tigerNewPosition = new Point3D(3, 0, 1);

            //tiger.Move(tigerNewPosition);

            //tiger.Attack(hunter);
            //tiger.Attack(hunter);
            //tiger.Attack(hunter);

            ////
            ///
            //List<object> gameObject = new List<object>()
            //{
            //    new Hunter("Ema","Smith",tigerNewPosition),
            //    new Tiger(Animals.animalType.ground,100,30,tigerNewPosition,2),
            //    new Vehicle()
            //};
            //var ema = new Hunter("Ema", "Smith", tigerNewPosition);
            //foreach (var gameObj in gameObject)
            //{
            //    Console.WriteLine(gameObj.ToString());

            //}
            //SpartaWrite(ema);



            //Airplane a = new Airplane(200, 100, "JetsRUs") { NumPassengers = 150 };
            //a.Ascend(500);
            //Console.WriteLine(a.Move(3));
            //Console.WriteLine(a);
            //a.Descend(200);
            //Console.WriteLine(a.Move());
            //a.Move();
            //Console.WriteLine(a);

            //Person jino = new Person("Jino", "Biba") {Age= 25};

            //Console.WriteLine(jino.GetFullName());

            //Person cathy;

            //cathy = new Person("Cathy","French");
            //cathy.Age = 20;

            //Console.WriteLine(cathy.GetFullName()+" "+cathy.Age);

            //Spartan spartan = new Spartan("Takis","Lakis");

            //Console.WriteLine(spartan.FirstName);
            //Console.WriteLine(spartan.LastName);

            //var list = new ShoppingList() {Bread =2, Potato =3 };

            //list.Lemon = 5;

            //var list2 = new ShoppingList();

            //list2.Milk = 5;

            //var milkAmount = list2.Milk;
            //Person jinakos = new Person("Jino", "Bimpa") { Age = 20 };
            //Point3D pr3D = new Point3D(5, 8, 2);
            //DemoMethod(pr3D, jinakos);

            //Hunter lauren = new Hunter("Lauren", "Pang", "Leica") {Age=20 };
            //Console.WriteLine(lauren.Shoot());
            //Console.WriteLine(lauren.Age);
            //Console.WriteLine(lauren.GetFullName());

            //Hunter h = new Hunter();
            //Console.WriteLine(lauren.ToString());
        }
コード例 #7
0
        public static void Main()
        {
            //Hunter bryn = new Hunter("Bryn", "Morley", "Sony") { Age = 25 };
            //Console.WriteLine(bryn);
            //Console.WriteLine(bryn.Age);
            //Console.WriteLine(bryn.Shoot());

            //Person nish = new Person("Nish", "Mandal");
            //Hunter cathy = new Hunter("Cathy", "French", "Nikon");
            //MonsterHunter phil = new MonsterHunter("Phil", "Anderson", "Nikon", "Love");

            //var safariList = new List<Hunter>();

            //safariList.Add(cathy);
            //safariList.Add(phil);

            //foreach (var item in safariList)
            //{
            //    Console.WriteLine(item);
            //}

            //Airplane a = new Airplane(200, 100, "JetsRUs")
            //{ NumPassengers = 150 };
            //a.Ascend(500);
            //Console.WriteLine(a.Move(3));
            //Console.WriteLine(a);
            //a.Descend(200);
            //Console.WriteLine(a.Move());
            //a.Move();
            //Console.WriteLine(a);

            //List<Object> gameObjects = new List<Object>()
            //     {
            //       new Person("Cathy", "French"),
            //       new Airplane(400,200,"Booing"),
            //       new Vehicle(12, 20),
            //       new Hunter("Henry", "Hodgkins", "Pentax")
            //     };
            //foreach (var gameObj in gameObjects)
            //{
            //    Console.WriteLine(gameObj);
            //}

            //var yolanda = new Person("Yolanda", "Young");
            //SpartaWrite(yolanda);


            ////var nish = new Hunter("Nish", "Mandal", "Leica");
            ////SpartaWrite(nish);

            //static void SpartaWrite(Object obj)
            //{
            //    Console.WriteLine(obj.ToString());

            //        var hunterObj = (Hunter)obj;
            //        Console.WriteLine(hunterObj.Shoot());

            //}

            //var cathy = new Person("Cathy", "French");
            //var booing = new Airplane(400, 200, "Booing");
            //var vehicle = new Vehicle(12, 20);
            //var henry = new Hunter("Henry", "Hodgkins", "Pentax");

            //List<IMovable> gameObjects = new List<IMovable>()
            //     {
            //       cathy,
            //       booing,
            //       vehicle,
            //       henry
            //     };

            //foreach (var item in gameObjects)
            //{

            //    Console.WriteLine(item.Move());
            //}

            //var theWeapons = new List<IShootable>();
            //theWeapons.Add(new WaterPistol("ToysRUs"));
            //theWeapons.Add(new LaserGun("Acme"));
            //theWeapons.Add(new Hunter("Cathy", "French", new Camera("Minolta")));
            //theWeapons.Add(new Camera("Pentax"));
            //foreach (var w in theWeapons)
            //{
            //    Console.WriteLine(w.Shoot());
            //}
            Console.WriteLine();
            Console.WriteLine("Polymorphic shootout");
            Camera      pentax   = new Camera("Pentax");
            WaterPistol pistol   = new WaterPistol("Supersoaker");
            LaserGun    laserGun = new LaserGun("Acme");
            Hunter      nish     = new Hunter("Nish", "Mandal", pentax);

            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
            Hunter phil = new Hunter("Phil", "Anderson");

            Console.WriteLine(phil.Shoot());
        }
コード例 #8
0
        static void Main(string[] args)
        {
            //Person cathy = new Person("Cathy", "French");
            //Console.WriteLine(cathy.GetFullName());
            //cathy.Age = -1;
            //Console.WriteLine("Cathy's Age: " + cathy.Age);
            //cathy.Age = 26;
            //Console.WriteLine("Cathy's Age: " + cathy.Age);
            //cathy.Age = -1;
            //Console.WriteLine("Cathy's Age: " + cathy.Age);

            //Person nish;
            //nish = new Person("Nish", "Mandal");
            //Console.WriteLine(nish.GetFullName());

            //var spartan = new Spartan {FirstName = "Nish", LastName = "Mandal", Age = 30 };
            //var age = spartan.Age;


            //var rouz = new Person();
            //rouz.Age = 22;
            //var callum = new Person("Callum", "Harding");
            //var michael = new Person("Michael", "Willcock", 22);

            //var hamse = new Person("Hamse", "Ahmed") { Age = 21 };

            //var shopList = new ShoppingList() { Bread = 2, Potato = 9 };
            //shopList.Potato = 7;

            //var shopList2 = new ShoppingList { Soap = 2 };

            // Point3d p;


            //Person paul = new Person("Paul", "McCartney") { Age = 80 };
            //Point3d pt3d = new Point3d(5, 8, 2);
            //DemoMethod(pt3d, paul);

            //Hunter h = new Hunter("Hossain", "Ghazal", "Leica") { Age = 22 };
            //Hunter h2 = new Hunter("Hossain", "Ghazal", "Leica") { Age = 22 };

            //Console.WriteLine($"{h} Equals {h2}? {h.Equals(h2)}");
            //Console.WriteLine($"{h} Hascode {h.GetHashCode()}");
            //Console.WriteLine($"{h} ToString");

            //Console.WriteLine(h.Age);
            //Console.WriteLine(h.Shoot());

            //var rectangle1 = new Rectangle { Width = 10, Height = 10 };
            //var rectangle2 = new Rectangle { Width = 15, Height = 10 };

            //var totalArea = 0;

            //var shapeList = new List<Shape> { rectangle1, rectangle2 };



            //foreach (var x in shapeList)
            //{
            //    totalArea = x.CalculateArea();
            //}

            //Airplane a = new Airplane(200, 100, "JetRUs") { NumPassengers = 150 };
            //a.Ascend(500);
            //Console.WriteLine(a.Move(3));
            //Console.WriteLine(a);

            //a.Descend(200);
            //Console.WriteLine(a.Move());

            //a.Move();
            //Console.WriteLine(a);

            //var gameObject = new List<Object>()
            //{
            //    new Person ("Nish", "Mandal"),
            //    new Airplane (400, 200, "Virgin Flights"),
            //    new Hunter("Tim", "Burton", "Nikon")
            //};

            //gameObject.ForEach(x => Console.WriteLine(x));

            //var liam = new Person("Liam", "Gallagher");
            //SpartaWrite(liam);

            //var cathy = new Person("Cathy", "French");
            //var nish = new Hunter("Nish", "Mandal", "Pentax");

            //var nishPerson = (Person)nish;
            //var cathyHunter = (Hunter)cathy;

            //SpartaWrite(nish);
            //Console.WriteLine();
            //SpartaWrite(cathy);

            //var safariObject = new List<IMoveable>()
            //{
            //    new Person("Michael", "Willcock"),
            //    new Person("Uzair", "Khan"),
            //    new Person("Hossain", "Ghazal")
            //};

            //safariObject.ForEach(x => Console.WriteLine(x.Move()));

            //var weaponObj = new List<IShootable>()
            //{
            //    new Hunter("Nish", "Mandal", new Camera("Pentax")),
            //    new Hunter("Nish", "Mandal", new WaterPistol("Supersoaker")),
            //    new Hunter("Nish", "Mandal", new LaserGun("Acme")),
            //    new Hunter("Nish", "Mandal", new WaterPistol("Supersoaker")),
            //    new Hunter("Michael", "Willcock", new Rifle("Springfield",".15 cartridges", 50))

            //};

            //weaponObj.ForEach(x => Console.WriteLine(x.Shoot()));

            var photographer = new Hunter("Geoff", "Bridges", new Camera("Kodak"));

            var springfieldRifle = new Rifle("Springfield", ".15 cartridges");
            var superSoaker      = new WaterPistol("Supersoaker", "ml of water", 1000);
            var spartanLaser     = new LaserGun("Spartan Laser", "kJ", 5000);

            var rifleShoot = new Hunter("Michael", "Willcock", springfieldRifle);
            var laserBlast = new Hunter("Master", "Chief", spartanLaser);

            Console.WriteLine(photographer.Shoot());

            Console.WriteLine(rifleShoot.Shoot());

            springfieldRifle.Fire(7);

            Console.WriteLine(rifleShoot.Shoot());

            Console.WriteLine(superSoaker.Shoot());

            superSoaker.Fire(10);

            Console.WriteLine(superSoaker.Shoot());

            superSoaker.Fire(1000);

            Console.WriteLine(superSoaker.Shoot());

            Console.WriteLine(laserBlast.Shoot());

            spartanLaser.Fire(50);

            Console.WriteLine(laserBlast.Shoot());

            spartanLaser.Fire(5000);

            Console.WriteLine(laserBlast.Shoot());
        }