Esempio n. 1
0
 public void TestForcedVentilationIntegration()
 {
     // Configure Animal Housing to be the Forced Ventilated Animal Housing
     ho = new AnimalHousing(new ForcedVentilation(6.0, 22.0, 1.5, 5.0, 0.8, 0.04, 0.8, 293.0, 2.0, 4.0, 10000.0), new Utility(), new DummyAnimal(1, 50, 650.0, 25.0, 0, 40.0));
     ho.Ventilation(1);
     Assert.AreEqual(0.0041322314049586778, ho.getVelocity());
 }
Esempio n. 2
0
 static public int CompareByRemoteness(IHousing x, IHousing y)
 {
     if (x.Remoteness == y.Remoteness)
     {
         return(0);
     }
     else if (x.Remoteness > y.Remoteness)
     {
         return(-1);
     }
     else
     {
         return(1);
     }
 }
Esempio n. 3
0
 static public int CompareByPrice(IHousing x, IHousing y)
 {
     if (x.Price == y.Price)
     {
         return(0);
     }
     else if (x.Price < y.Price)
     {
         return(-1);
     }
     else
     {
         return(1);
     }
 }
Esempio n. 4
0
        public static void CollectInput(Farm farm, IHousing animal)
        {
            Console.Clear();

            for (int i = 0; i < farm.DuckHouses.Count; i++)
            {
                DuckHouse house = farm.DuckHouses[i];
                if (house.Capacity > 0)
                {
                    Console.WriteLine($"{i + 1}. Duck House");
                    Console.Write($"Current animals: {house.GetList().Count}");
                    Console.WriteLine();
                }
            }


            if (farm.DuckHouses.Count >= 1)
            {
                Console.WriteLine();
                // How can I output the type of animal chosen here?
                Console.WriteLine($"Place the animal where?");
                Console.Write("> ");
                int choice = Int32.Parse(Console.ReadLine());
                int index  = choice - 1;

                farm.DuckHouses[index].AddResource(animal);
            }
            else
            {
                Console.WriteLine("No Field to select from, Please purchase an appropriate facility. ");
                Console.ReadLine();
            }

            /*
             *  Couldn't get this to work. Can you?
             *  Stretch goal. Only if the app is fully functional.
             */
            // farm.PurchaseResource<IGrazing>(animal, choice);
        }
Esempio n. 5
0
 static public int CompareByName(IHousing x, IHousing y)
 {
     return(string.Compare(x.Name, y.Name));
 }