コード例 #1
0
        static void DisplayGetUserSeaMonster(List <SeaMonster> seaMonsters)

        {
            SeaMonster newSeaMonster = new SeaMonster();

            DisplayHeader("add a seamonster");

            Console.Write("Enter name of new seamonster:");
            newSeaMonster.Name = Console.ReadLine();
            Console.Write("Enter home sea of new seamonster:");
            newSeaMonster.HomeSea = Console.ReadLine();
            Console.Write("Enter Weight");
            double.TryParse(Console.ReadLine(), out double weight);
            newSeaMonster.Weight = weight;
            Console.Write("Can use freshwater?");
            if (Console.ReadLine().ToUpper() == "YES")
            {
                newSeaMonster.CanUseFreshWater = true;
            }
            else
            {
                newSeaMonster.CanUseFreshWater = false;
            }
            Console.Write("Enter Emotional State");
            Enum.TryParse(Console.ReadLine(), out SeaMonster.EmotionalState emotionalState);
            newSeaMonster.CurrentEmotionalState = emotionalState;

            seaMonsters.Add(newSeaMonster);

            DisplayContinuePrompt();
        }
コード例 #2
0
        static void DisplayMenu(SeaMonster mySeaMonster, SpaceMonster mySpaceMonster)
        {
            bool exitMenu = false;
            int  menuSelection;

            do
            {
                Console.Clear();
                DisplayHeader("Menu");
                Console.WriteLine("1) Display Monsters");
                Console.WriteLine("2) Exit");
                Console.WriteLine();
                Console.Write("Enter Selection:");
                menuSelection = int.Parse(Console.ReadLine());

                switch (menuSelection)
                {
                case 1:
                    DisplayMonsterInfoScreen(mySeaMonster, mySpaceMonster);
                    break;

                case 2:
                    exitMenu = true;
                    break;

                default:
                    Console.WriteLine("Please enter a proper selection.");
                    DisplayContinuePrompt();
                    break;
                }
            } while (!exitMenu);
        }
コード例 #3
0
        // Sea Monster Methods
        static List <SeaMonster> InitializeSeaMonster(List <SeaMonster> AllSeaMonsters) // Create a new SeaMonster
        {
            SeaMonster seaMonster = new SeaMonster();

            seaMonster.Id        = 34;
            seaMonster.Name      = "Suzy";
            seaMonster.Age       = 473;
            seaMonster.Height    = 300;
            seaMonster.Weight    = 9000;
            seaMonster.Color     = "Light Blue";
            seaMonster.EatHumans = false;
            seaMonster.PlaysGolf = true;
            seaMonster.HasGills  = true;
            seaMonster.HomeSea   = "Baltic Sea";

            AllSeaMonsters.Add(seaMonster);

            SeaMonster seaMonster2 = new SeaMonster();

            seaMonster2.Id        = 19;
            seaMonster2.Name      = "Fred";
            seaMonster2.Age       = 1320;
            seaMonster2.Height    = 3590;
            seaMonster2.Weight    = 20000;
            seaMonster2.Color     = "Dark Yellow";
            seaMonster2.EatHumans = true;
            seaMonster2.PlaysGolf = true;
            seaMonster2.HasGills  = true;
            seaMonster2.HomeSea   = "Red Sea";

            AllSeaMonsters.Add(seaMonster2);

            return(AllSeaMonsters);
        }
コード例 #4
0
        private static void DisplayFightingSeaMonster(SeaMonster seaMonster)
        {
            DisplayHeader("Fighting Nessy");

            Console.WriteLine($"You attack {seaMonster.Name} and they {seaMonster.MonsterBattleResponse()}");

            DisplayContinuePrompt();
        }
コード例 #5
0
 private static void DisplaySeaMonsterInfo(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.id}");
     Console.WriteLine($"name: {seaMonster.name}");
     Console.WriteLine($"age: {seaMonster.age}");
     Console.WriteLine($"home sea: {seaMonster.HomeSea}");
     Console.WriteLine($"Has Gills?{(seaMonster.HasGills ? "yes" : "no")}");
     Console.WriteLine($"Is happy: {seaMonster.IsHappy()}");
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: jheimforth/MonsterClasses
 private static void DisplaySeaMonsterInfo(SeaMonster seasMonster)
 {
     Console.WriteLine($"Id: {seasMonster.Id}");
     Console.WriteLine($"Name: {seasMonster.Name}");
     Console.WriteLine($"Age: {seasMonster.Age}");
     Console.WriteLine($"Gills: {seasMonster.HasGills}");
     Console.WriteLine($"Home Sea: {seasMonster.HomeSea}");
     Console.WriteLine($"Is Happy: {seasMonster.IsHappy()}");
 }
コード例 #7
0
 private static void DisplaySeaMonsterInfo(SeaMonster seasMonster)
 {
     Console.WriteLine($"Id: {seasMonster.Id}");
     Console.WriteLine($"Name: {seasMonster.Name}");
     Console.WriteLine($"Age: {seasMonster.Age}");
     Console.WriteLine($"Gills: {seasMonster.HasGills}");
     Console.WriteLine($"Home Sea: {seasMonster.HomeSea}");
     Console.WriteLine($"Is Happy: {seasMonster.IsHappy()}");
     Console.WriteLine($"You Attacked {seasMonster.Name} and they {seasMonster.MonsterBattleResponse()} in response");
 }
コード例 #8
0
 private static void DisplaySeaMonster(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.ID}");
     Console.WriteLine($"Name: {seaMonster.Name}");
     Console.WriteLine($"Age: {seaMonster.Age}");
     Console.WriteLine($"Active: {(seaMonster.IsActive ? "Yes" : "No")}");
     Console.WriteLine($"Has Gills: {(seaMonster.HasGills ? "Yes" : "No")}");
     Console.WriteLine($"Sea Name: {seaMonster.SeaName}");
     seaMonster.Greeting();
     seaMonster.IsHappy();
 }
コード例 #9
0
        static List <SeaMonster> DisplaySeaMonsterEditingMenu(List <SeaMonster> AllSeaMonsters)
        {
            int  userChoice;
            bool loop = true;

            do
            {
                do
                {
                    DisplayHeader("SEA MONSTER EDITING MENU");
                    Console.WriteLine();

                    LeftJustifyText(" 1) View All Sea Monsters", 63);
                    LeftJustifyText(" 2) Add New", 63);
                    LeftJustifyText(" 3) Edit", 63);
                    LeftJustifyText(" 4) Delete", 63);
                    LeftJustifyText(" 5) Return to Monster Editing Menu", 63);

                    CenterText(" Please type your selection's number, then press enter. ", 57);
                } while (!int.TryParse(Console.ReadLine(), out userChoice) && userChoice > 0 && userChoice <= 5);

                switch (userChoice)
                {
                case 1:
                    DisplayHeader("Sea Monster Info");
                    DisplaySeaMonsterInfo(AllSeaMonsters);
                    DisplayUserPause("continue");
                    break;

                case 2:
                    SeaMonster userSeaMonster = DisplayAddNewSeaMonster();
                    AllSeaMonsters.Add(userSeaMonster);
                    break;

                case 3:
                    AllSeaMonsters = DisplayEditSeaMonster(AllSeaMonsters);

                    break;

                case 4:
                    AllSeaMonsters = DisplayDeleteSeaMonster(AllSeaMonsters);
                    break;

                case 5:
                    loop = false;
                    break;
                }
            } while (loop);



            return(AllSeaMonsters);
        }
コード例 #10
0
        static void DisplayMonsterInfoScreen(SeaMonster seaMonster, SpaceMonster spaceMonster)
        {
            DisplayHeader("Monster Info");
            Console.WriteLine("Sea Monster");
            DisplaySeaMonsterInfo(seaMonster);

            Console.WriteLine();
            Console.WriteLine("Space Monster");
            DisplaySpaceMonsterInfo(spaceMonster);

            DisplayContinuePrompt();
        }
コード例 #11
0
        static void DisplayMonsterInfoScreen(SeaMonster seaMonster, SpaceMonster spaceMonster, ForestMonster forestMonster)
        {
            DisplayHeader("Monster Information");

            DisplaySeaMonster(seaMonster);
            Console.WriteLine();
            DisplaySpaceMonster(spaceMonster);
            Console.WriteLine();
            DisplayForestMonster(forestMonster);

            DisplayContinuePrompt();
        }
コード例 #12
0
 private static void DisplayEditSeaMonster(SeaMonster mySeaMonster)
 {
     DisplayHeader("edit sea monster");
     Console.WriteLine($"what name would like your sea monster: {mySeaMonster.name} to be?");
     mySeaMonster.name = Console.ReadLine();
     Console.WriteLine($"your name is now changed to: {mySeaMonster.name}");
     Console.WriteLine();
     Console.WriteLine($"what is your home sea:{mySeaMonster.HomeSea}");
     mySeaMonster.HomeSea = Console.ReadLine();
     Console.WriteLine($"your home sea is the:{mySeaMonster.HomeSea}");
     DisplayContinuePrompt();
 }
コード例 #13
0
        static SeaMonster InitializeSeaMonsterSid(string name)

        {
            SeaMonster sid = new SeaMonster("Sid");

            sid.Weight                = 2.5;
            sid.CanUseFreshWater      = true;
            sid.CurrentEmotionalState = SeaMonster.EmotionalState.Sad;
            sid.HomeSea               = "caspian";


            return(sid);
        }
コード例 #14
0
 private static void DisplaySeaMonsterInfo(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.Id}");
     Console.WriteLine($"Name: {seaMonster.Name}");
     Console.WriteLine($"Age: {seaMonster.Age}");
     Console.WriteLine($"Height: {seaMonster.Height}");
     Console.WriteLine($"Weight: {seaMonster.Weight}");
     Console.WriteLine($"Home Sea: {seaMonster.HomeSea}");
     Console.WriteLine($"Has Gills: {(seaMonster.HasGills ? "Yes" : "No")}");
     Console.WriteLine($"Is Happy: {(seaMonster.IsHappy() ? "Yes" : "No")}");
     Console.WriteLine(seaMonster.Roar());
     Console.WriteLine(seaMonster.Greeting());
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: jheimforth/MonsterClasses
        private static void DisplayMonsterInfoScreen(SeaMonster seasMonster, SpaceMonster spaceMonster, DesertMonster myDesertMonster)
        {
            DisplayHeader("Monster Info");

            Console.WriteLine("Sea Monster");
            DisplaySeaMonsterInfo(seasMonster);

            Console.WriteLine();
            Console.WriteLine("Space Monster");
            DisplaySpaceMonster(spaceMonster);

            Console.ReadKey();
        }
コード例 #16
0
        static SeaMonster InitializeSeaMonsterSuzy()

        {
            SeaMonster suzy = new SeaMonster();

            suzy.Name                  = "suzy";
            suzy.Weight                = 1.2;
            suzy.CanUseFreshWater      = true;
            suzy.CurrentEmotionalState = SeaMonster.EmotionalState.Happy;
            suzy.HomeSea               = "caspian";

            return(suzy);
        }
コード例 #17
0
 private static void DisplaySeaMonsterInfo(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.Id}");
     Console.WriteLine($"Name: {seaMonster.Name}");
     Console.WriteLine($"Age: {seaMonster.Age}");
     Console.WriteLine($"Home Sea: {seaMonster.HomeSea}");
     Console.WriteLine($"Has Gills: {seaMonster.HasGills}");
     Console.WriteLine($"Is Happy: {seaMonster.IsHappy()}");
     Console.WriteLine($"Toughness: {seaMonster.Toughness}");
     Console.WriteLine($"Ferociousness: {seaMonster.Ferociousness}");
     Console.WriteLine($"{(seaMonster.IsTough() ? "I am very tough" : "I am not very tough")}");
     Console.WriteLine($"{seaMonster.Name} is attacked and {(seaMonster.MonsterBattleHurt() ? "is hurt" : "is not hurt")}");
 }
コード例 #18
0
 static void DisplaySeaMonster(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.ID}");
     Console.WriteLine($"Name: {seaMonster.Name}");
     Console.WriteLine($"Age: {seaMonster.Age}");
     Console.WriteLine($"Gills: {seaMonster.HasGills}");
     Console.WriteLine($"Tentecals: {seaMonster.HasTentecals}");
     Console.WriteLine($"Active: {(seaMonster.IsActive ? "Yes" : "No")}");
     Console.WriteLine($"Happiness Status: {seaMonster.IsHappy()}");
     Console.WriteLine($"Home: {seaMonster.SeaName}");
     Console.WriteLine($"Fighting Style: {seaMonster.FightingStyle}");
     Console.WriteLine($"{seaMonster.Greeting()}");
     Console.WriteLine($"{seaMonster.Background()}");
     Console.WriteLine($"Fights Won: {seaMonster.FightsWon()}");
     Console.WriteLine($"High Value Target: {seaMonster.isHVT}");
 }
コード例 #19
0
 private static void DisplaySeamMonsterInfo(SeaMonster seaMonster)
 {
     Console.WriteLine($"Id: {seaMonster.Id}");
     Console.WriteLine($"Name: {seaMonster.Name}");
     Console.WriteLine($"Age: {seaMonster.Age}");
     Console.WriteLine($"Language: {seaMonster.Language}");
     Console.WriteLine($"Color: {seaMonster.Color}");
     Console.WriteLine($"Weight: {seaMonster.Weight}");
     Console.WriteLine($"Has a Tail: {seaMonster.HasTail}");
     Console.WriteLine($"Can Fly: {seaMonster.CanFly}");
     Console.WriteLine($"Home Sea: {seaMonster.HomeSea}");
     Console.WriteLine($"Has Gills: {seaMonster.HasGills}");
     Console.WriteLine($"Lays Eggs: {seaMonster.LaysEggs}");
     Console.WriteLine($"Is Happy: {seaMonster.IsHappy()}");
     Console.WriteLine($"Is Hostile: {(seaMonster.IsHostile() ? "yes" : "no")}");
 }
コード例 #20
0
        static void DisplayMenu()
        {
            bool         exitMenu = false;
            SeaMonster   Nessy    = InitializeSeaMonster();
            SpaceMonster Jaal     = InitializeSpaceMonsters();


            do
            {
                DisplayHeader("Menu");
                Console.WriteLine("A) Display Monsters");
                Console.WriteLine("B) Fight Jaal");
                Console.WriteLine("C) Fight Nessy");
                Console.WriteLine("Q) Exit");
                Console.WriteLine("Enter Choice");
                string userChoice = Console.ReadLine().ToUpper();

                switch (userChoice)
                {
                case "A":
                    DisplayMonsterInfoScreen(Nessy, Jaal);
                    break;

                case "B":
                    DisplayFightingSpaceMonster(Jaal);
                    break;

                case "C":
                    DisplayFightingSeaMonster(Nessy);
                    break;

                case "Q":
                    DisplayClosingScreen();
                    exitMenu = true;
                    break;

                default:
                    Console.WriteLine("Please enter a valid choice");
                    DisplayContinuePrompt();
                    break;
                }
            } while (!exitMenu);
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: jheimforth/MonsterClasses
        private static void EditSeaMonster(SeaMonster mySeaMonster)
        {
            DisplayHeader("Edit your Sea Monster");

            Console.WriteLine("What name would you like to change the Sea Monster to?");
            mySeaMonster.Name = Console.ReadLine();
            Console.WriteLine();

            Console.WriteLine("What is the ID number for this Monster?");
            mySeaMonster.Id = int.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What is their new age?");
            mySeaMonster.Age = int.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What is their new home sea?");
            mySeaMonster.HomeSea = Console.ReadLine();

            Console.WriteLine("Press any Key to return to the previous menu.");
            Console.ReadKey();
        }
コード例 #22
0
        private static void DisplayEditMonster(SeaMonster mySeaMonster, SpaceMonster mySpaceMonster, DesertMonster myDesertMonster)
        {
            string menuSelection;
            bool   exitMenu = false;

            do
            {
                DisplayHeader("Edit your Monster");

                Console.WriteLine("Please Select A Monster to edit");
                Console.WriteLine($"A) {mySeaMonster.Name}");
                Console.WriteLine($"B) {mySpaceMonster.Name}");
                Console.WriteLine($"C) {myDesertMonster.Name}");
                Console.WriteLine("D) Return to Main Menu");
                menuSelection = Console.ReadLine().ToUpper();
                switch (menuSelection)
                {
                case "A":
                    EditSeaMonster(mySeaMonster);
                    break;

                case "B":
                    EditSpaceMonster(mySpaceMonster);
                    break;

                case "C":
                    EditDesertMonster(myDesertMonster);
                    break;

                case "D":
                    exitMenu = true;
                    break;

                default:
                    break;
                }
            } while (!exitMenu);
        }
コード例 #23
0
        static void DisplayMenu()
        {
            bool exitMenu = false;

            SeaMonster    suzy  = InitializeSeaMonster();
            SpaceMonster  sid   = InitializeSpaceMonster();
            ForestMonster sammy = InitializeForestMonster();

            do
            {
                DisplayHeader("Menu");
                Console.WriteLine("1) Display Monsters");
                Console.WriteLine("2) Exit");
                Console.WriteLine("3) Add a Sea Monster");
                Console.Write("Enter Choice:");
                int userChoice = int.Parse(Console.ReadLine());

                switch (userChoice)
                {
                case 1:
                    DisplayMonsterInfoScreen(suzy, sid, sammy);
                    break;

                case 2:
                    exitMenu = true;
                    break;

                case 3:
                    CreateSeaMonster(suzy);
                    break;

                default:
                    Console.WriteLine("Please enter a valid choice.");
                    DisplayContinuePrompt();
                    break;
                }
            } while (!exitMenu);
        }
コード例 #24
0
        private static void CreateSeaMonster(SeaMonster seaMonsters)
        {
            SeaMonster newSeaMonster = new SeaMonster();

            DisplayHeader("Add a Sea Monster");

            Console.Write("Enter Name:");
            newSeaMonster.Name = Console.ReadLine();
            Console.Write("Enter ID:");
            int seaMonsterID = int.Parse(Console.ReadLine());

            newSeaMonster.ID = seaMonsterID;
            Console.Write("Has Gills:");
            if (Console.ReadLine().ToUpper() == "YES")
            {
                newSeaMonster.HasGills = true;
            }
            else
            {
                newSeaMonster.HasGills = false;
            }
            Console.Write("Is Active:");
            if (Console.ReadLine().ToUpper() == "YES")
            {
                newSeaMonster.IsActive = true;
            }
            else
            {
                newSeaMonster.IsActive = false;
            }
            Console.Write("Enter Sea Name:");
            newSeaMonster.SeaName = Console.ReadLine();



            DisplayContinuePrompt();
        }
コード例 #25
0
 private static void DisplayEditSeaMonster(SeaMonster mySeaMonster)
 {
     DisplayHeader("Edit Sea Monster Info");
 }
コード例 #26
0
        static SeaMonster DisplayAddNewSeaMonster() // User creates a new SeaMonster.
        {
            SeaMonster userSeaMonster = new SeaMonster();
            int        userInt;
            bool       userBool;
            bool       isValid = true;

            DisplayHeader("Add New Sea Monster");
            Console.WriteLine();

            do
            {
                isValid = true;

                CenterPadText(" New ID: ".PadLeft(30));
                if (!int.TryParse(Console.ReadLine(), out userInt))
                {
                    CenterText("That is not a valid entry. Please try again with an integer. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.Id = userInt;
                }
            } while (!isValid); // Get ID

            CenterPadText("New Name: ");
            userSeaMonster.Name = Console.ReadLine();

            do
            {
                isValid = true;

                CenterPadText(" New Age: ".PadLeft(30));
                if (!int.TryParse(Console.ReadLine(), out userInt))
                {
                    CenterText("That is not a valid entry. Please try again with an integer. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.Age = userInt;
                }
            } while (!isValid); // Get Age

            do
            {
                isValid = true;

                CenterPadText(" New Height: ".PadLeft(30));
                if (!int.TryParse(Console.ReadLine(), out userInt))
                {
                    CenterText("That is not a valid entry. Please try again with an integer. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.Height = userInt;
                }
            } while (!isValid); // Get Height

            do
            {
                isValid = true;

                CenterPadText(" New Weight: ".PadLeft(30));
                if (!int.TryParse(Console.ReadLine(), out userInt))
                {
                    CenterText("That is not a valid entry. Please try again with an integer. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.Weight = userInt;
                }
            } while (!isValid); // Get ID

            CenterPadText("New Color: ");
            userSeaMonster.Color = Console.ReadLine();

            do
            {
                isValid = true;

                CenterPadText(" New 'Eats Humans?': ".PadLeft(30));
                if (!bool.TryParse(Console.ReadLine(), out userBool))
                {
                    CenterText("That is not a valid entry. Please try again with 'true' or 'false'. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.EatHumans = userBool;
                    isValid = true;
                }
            } while (!isValid); // Get Eats Humans

            do
            {
                isValid = true;

                CenterPadText(" New 'Plays Golf?': ".PadLeft(30));
                if (!bool.TryParse(Console.ReadLine(), out userBool))
                {
                    CenterText("That is not a valid entry. Please try again with 'true' or 'false'. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.PlaysGolf = userBool;
                    isValid = true;
                }
            } while (!isValid); // Get Plays Golf

            do
            {
                isValid = true;

                CenterPadText(" New 'Has Gills?': ".PadLeft(30));
                if (!bool.TryParse(Console.ReadLine(), out userBool))
                {
                    CenterText("That is not a valid entry. Please try again with 'true' or 'false'. \n");
                    isValid = false;
                }
                else
                {
                    userSeaMonster.HasGills = userBool;
                    isValid = true;
                }
            } while (!isValid); // Get Has Gills

            CenterPadText("New Home Sea: ");
            userSeaMonster.HomeSea = Console.ReadLine();

            return(userSeaMonster);
        }
コード例 #27
0
ファイル: TradeStore.cs プロジェクト: pjruddy1/MonsterClasses
 public MonsterCommunications MonsterTradeInteractionResponse(SpaceMonster spaceMonster, SeaMonster seaMonster)
 {
     if (seaMonster.Gold <= WeaponSlotPrice3 && spaceMonster.Gold <= WeaponSlotPrice3 && seaMonster.Gold >= ArmourSlotPrice3 && spaceMonster.Gold >= ArmourSlotPrice3)
     {
         return(MonsterCommunications.THREATEN);
     }
     else if (seaMonster.Gold >= WeaponSlotPrice1 || spaceMonster.Gold >= WeaponSlotPrice1 || seaMonster.Gold >= ArmourSlotPrice1 || spaceMonster.Gold >= ArmourSlotPrice1)
     {
         return(MonsterCommunications.TRADE);
     }
     else if (seaMonster.Gold >= WeaponSlotPrice2 || seaMonster.Gold >= ArmourSlotPrice2 || spaceMonster.Gold >= ArmourSlotPrice2)
     {
         return(MonsterCommunications.HAPPY);
     }
     else if (seaMonster.Gold >= WeaponSlotPrice3 || spaceMonster.Gold >= WeaponSlotPrice3 || seaMonster.Gold >= ArmourSlotPrice3 || spaceMonster.Gold >= ArmourSlotPrice3)
     {
         return(MonsterCommunications.BEG);
     }
     else
     {
         return(MonsterCommunications.ANGRY);
     }
 }
コード例 #28
0
        private static void DisplayEditSeaMonster(SeaMonster mySeaMonster)
        {
            int    userResponseNum;
            double userResponseNum1;
            string userResponse;
            bool   loop = true;

            DisplayHeader("Edit Sea Monster");
            Console.WriteLine();

            while (loop)
            {
                Console.Write("Id: ");

                if (int.TryParse(Console.ReadLine(), out userResponseNum))
                {
                    mySeaMonster.Id = userResponseNum;
                    loop            = false;
                }
                else
                {
                    Console.WriteLine("Please enter a valid whole number.");
                }
            }
            Console.Write("Name: ");
            mySeaMonster.Name = Console.ReadLine();
            while (!loop)
            {
                Console.Write("Age: ");
                if (int.TryParse(Console.ReadLine(), out userResponseNum))
                {
                    mySeaMonster.Age = userResponseNum;
                    loop             = true;
                }
                else
                {
                    Console.WriteLine("Please enter a valid whole number.");
                }
            }
            while (loop)
            {
                Console.Write("Height: ");

                if (double.TryParse(Console.ReadLine(), out userResponseNum1))
                {
                    mySeaMonster.Height = userResponseNum1;
                    loop = false;
                }
                else
                {
                    Console.WriteLine("Please enter a valid number.");
                }
            }
            while (!loop)
            {
                Console.Write("Weight: ");

                if (double.TryParse(Console.ReadLine(), out userResponseNum1))
                {
                    mySeaMonster.Weight = userResponseNum1;
                    loop = true;
                }
                else
                {
                    Console.WriteLine("Please enter a valid number.");
                }
            }
            while (loop)
            {
                Console.Write("Has Gills: ");
                userResponse = Console.ReadLine().ToUpper();

                if (userResponse == "YES")
                {
                    mySeaMonster.HasGills = true;
                    loop = false;
                }
                else if (userResponse == "NO")
                {
                    mySeaMonster.HasGills = false;
                    loop = false;
                }
                else
                {
                    Console.WriteLine("Please enter Yes or No.");
                }
            }
            Console.Write("Home Sea: ");
            mySeaMonster.HomeSea = Console.ReadLine();
        }
コード例 #29
0
 private static void DisplayEditSeaMonster(SeaMonster mySeaMonster)
 {
 }