コード例 #1
0
        }//end TestEnhancedHumans



        static void TestSuperHumans() {

            Console.WriteLine("TESTING SUPER HUMANS *****************************************");
            Super_Human WonderWoman = new Super_Human("Wonder Woman", "Diana Prince", new List<SuperPower> { SuperPower.SuperStrength, SuperPower.SuperIntellect });

            Super_Human Superman = new Super_Human("Superman", "Clark Kent", new List<SuperPower> {SuperPower.Flight, SuperPower.SuperStrength, SuperPower.XRayVision,
                                                                                              SuperPower.SuperSpeed, SuperPower.Invulnerability});
            Console.WriteLine("\nSH1: When Superman came to Earth he already had super powers\n[Superman, 385]:\t\t {0}, {1}\n", Superman.CurrentIdentity, Superman.TotalPower());

            Superman.SwitchIdentity();

            Console.WriteLine("\nSH2: He retains his super powers even in his secret identity:\n[Clark Kent, 385]:\t\t {0}, {1}\n", Superman.CurrentIdentity, Superman.TotalPower());

            Superman.LoseAllSuperPowers();

            Console.WriteLine("\nSH3: However when exposed to kryponite he loses all of his powers:\n[Clark Kent, 0]:\t\t {0}, {1}\n", Superman.CurrentIdentity, Superman.TotalPower());

            Console.WriteLine("\nSH4: But kryponite has no effect on Wonder Woman who has all of her powers:\n[Wonder  Women, 165]:\t\t {0}, {1}\n", WonderWoman.CurrentIdentity, WonderWoman.TotalPower());

            WonderWoman.SwitchIdentity();

            Console.WriteLine("\nSH5: when she switches to her plain identity she still has \"Wisom of Athena\":\n[Diana Prince, Yes]:\t\t {0}, {1}\n", WonderWoman.CurrentIdentity,
                                                                        (WonderWoman.HasPower(SuperPower.SuperIntellect) ? "Yes" : "No"));


            //   ADD CALL TO YOUR METHOD TO REINSTATE SUPER_HUMAN POWERS 

            //Console.WriteLine("\nSH6: Fortuantely if the kryptonite is removed, \nSuperman regains his original powers:\n[Clark Kent, 385]:\t\t {0}, {1}", Superman.CurrentIdentity, Superman.TotalPower());

        }//end TestSuperHumans
コード例 #2
0
ファイル: Program.cs プロジェクト: sawsoemoenyunt/AMSExercise
        }//end TestEnhancedHumans

        static void TestSuperHumans()
        {
            Super_Human WonderWoman = new Super_Human("Wonder Woman", "Diana Prince", new List <SuperPower> {
                SuperPower.SuperStrength, SuperPower.SuperIntellect
            });

            Super_Human Superman = new Super_Human("Superman", "Clark Kent", new List <SuperPower> {
                SuperPower.Flight, SuperPower.SuperStrength, SuperPower.XRayVision,
                SuperPower.SuperSpeed, SuperPower.Invulnerability
            });

            Console.WriteLine("\n\n SH1: When Superman came to Earth he already had super powers[Superman, 385]: \n\n\t\t\t {0}, {1}\n\n", Superman.CurrentIdentity(), Superman.TotalPower());

            Superman.SwitchIdentity();

            Console.WriteLine("\n\n SH2: He retains his super powers even in his secret identity. [Clark Kent, 385]: \n\n\t\t\t {0}, {1}\n\n", Superman.CurrentIdentity(), Superman.TotalPower());

            Superman.LoseAllSuperPowers();

            Console.WriteLine("\n\n SH3: However when exposed to kryponite he loses all of his powers. [Clark Kent, 0]: \n\n\t\t\t {0}, {1}\n\n", Superman.CurrentIdentity(), Superman.TotalPower());

            Console.WriteLine("\n\n SH4: But kryponite has no effect on Wonder Woman who has all of her powers. [Wonder  Women, 165]: \n\n\t\t\t {0}, {1}\n\n", WonderWoman.CurrentIdentity(), WonderWoman.TotalPower());

            WonderWoman.SwitchIdentity();

            Console.WriteLine("\n\n SH5: when she switches to her plain identity she still has her \"Wisom of Athena\" [Diana Prince, Yes]: \n\n\t\t\t {0}, {1}\n\n", WonderWoman.CurrentIdentity(),
                              (WonderWoman.HasPower(SuperPower.SuperIntellect) ? "Yes" : "No"));


            //   READ Activity 3 (c) - call to your method   for (c) goes here

            //    Console.WriteLine("\n\n SH6: Fortuantely if the kryptonite is removed, Superman regains his original powers. [Clark Kent, 385]:\n\n\t\t\t {0}, {1}\n\n", Superman.CurrentIdentity(), Superman.TotalPower());
        } //end TestSuperHumans