Exemplo n.º 1
0
        public void Run()
        {
            Pets pets = new Pets();

            string userInput = "";

            Menu();

            userInput = Console.ReadLine().ToLower();

            while (userInput != "e")
            {
                switch (userInput)
                {
                case "1":
                    DisplayPets(pets);
                    break;

                case "2":
                    AddPet(pets);
                    break;

                case "3":
                    RemovePet(pets);
                    break;

                case "e":
                    continue;

                default:
                    Console.WriteLine("Please make a valid selection");
                    break;
                }

                Menu();

                userInput = Console.ReadLine().ToLower();
            }

            Console.WriteLine("Program ending. Press ENTER.");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        private void AddPet(Pets pets)
        {
            Pet pet = new Pet();

            Console.WriteLine("Pet number");
            pet.Number = int.Parse(Console.ReadLine());

            Console.WriteLine("Pet name");
            pet.Name = Console.ReadLine();

            Console.WriteLine("Family name");
            pet.FamilyName = Console.ReadLine();

            Console.WriteLine("Pet type");
            pet.PetType = Console.ReadLine();

            pets.AddPet(pet);

            Console.WriteLine("Pet added.");
        }