//Adds Duck House field when creating new facility. public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); Console.WriteLine("Duck House Added"); Console.WriteLine("Press enter to return to Main Menu"); Console.ReadLine(); }
public void AddDuckHouse(DuckHouse field) { DuckHouses.Add(field); Console.WriteLine("Duck House has been added"); Console.WriteLine("Press enter key to continue"); Console.ReadLine(); }
public override string ToString() { StringBuilder report = new StringBuilder(); GrazingFields.ForEach(gf => report.Append(gf)); PlowedFields.ForEach(pf => report.Append(pf)); NaturalFields.ForEach(nf => report.Append(nf)); DuckHouse.ForEach(dh => report.Append(dh)); ChickenHouse.ForEach(ch => report.Append(ch)); return(report.ToString()); }
public Farm() { FileHandler = new FileHandler(); SeedHarvester = new SeedHarvester(FileHandler); Composter = new Composter(FileHandler); MeatProcessor = new MeatProcessor(FileHandler); FeatherGatherer = new FeatherGatherer(FileHandler); EggGatherer = new EggGatherer(FileHandler); FileHandler.Facilities.ForEach(fac => { IFacility newFacility = null; string[] facilityData = fac.Split(":"); string type = facilityData[0]; string name = facilityData[1]; string data = facilityData[2]; switch (type) { case "Chicken House": newFacility = new ChickenHouse(name, data); break; case "Duck House": newFacility = new DuckHouse(name, data); break; case "Grazing Field": newFacility = new GrazingField(name, data); break; case "Plowed Field": newFacility = new PlowedField(name, data); break; case "Natural Field": newFacility = new NaturalField(name, data); break; default: throw new Exception("Invalid data"); } Facilities.Add(newFacility); }); }
public static void CollectInput(Farm farm, Duck duck) { Console.Clear(); DuckHouse anyHouseWithRoom = farm.DuckHouses.Find(dh => dh.CurrentCapacity < dh.MaxCapacity); if (anyHouseWithRoom != null) { for (int i = 0; i < farm.DuckHouses.Count; i++) { DuckHouse currentHouse = farm.DuckHouses[i]; if (currentHouse.CurrentCapacity < currentHouse.MaxCapacity) { Console.WriteLine($"{i + 1}. {currentHouse}"); } } Console.WriteLine(); // How can I output the type of plant chosen here? if (UserTriedToSelectAFullFacility) { Console.WriteLine("That facility is already full."); } Console.WriteLine($"Place the duck where?"); Console.Write("> "); int choice = Int32.Parse(Console.ReadLine()) - 1; farm.DuckHouses[choice].AddResource(farm, duck); } else { PurchaseStock.ThereIsNoRoomForTheAnimalBeingPurchased = true; Program.DisplayBanner(); PurchaseStock.CollectInput(farm); } /* * Couldn't get this to work. Can you? * Stretch goal. Only if the app is fully functional. */ // farm.PurchaseResource<IGrazing>(animal, choice); }
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); }
public static void CollectInput(Farm farm, IResource animal) { Console.Clear(); for (int i = 0; i < farm.DuckHouses.Count; i++) { if (farm.DuckHouses[i].Ducks.Count < farm.DuckHouses[i].Capacity) { DuckHouse specificHouse = farm.DuckHouses[i]; Console.WriteLine($"{i + 1}. {specificHouse}"); } } Console.WriteLine(); // How can I output the type of animal chosen here? Console.WriteLine($"Place the animal where?"); Console.Write("> "); try { int choice = Int32.Parse(Console.ReadLine()) - 1; farm.DuckHouses[choice].AddResource(animal); } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex); } /* * Couldn't get this to work. Can you? * Stretch goal. Only if the app is fully functional. */ // farm.PurchaseResource<IGrazing>(animal, choice); }
public void AddDuckHouse(DuckHouse duckHouse) { DuckHouses.Add(duckHouse); }
public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); Console.WriteLine("You have added a Duck house!"); }
public void AddDuckHouse(DuckHouse house) { AvailableDuckHouses.Add(house); DuckHouses.Add(house); }
public void AddDuckHouse(DuckHouse duckHouse) { DuckHouseList.Add(duckHouse); FacilityList.Add(duckHouse); }
public void AddDuckHouse(DuckHouse field) => DuckHouse.Add(field);
public void AddDuckHouse(DuckHouse duckHouse) { DuckHouse.Add(duckHouse); Console.WriteLine("You have added a Duck House!"); Thread.Sleep(1000); }
public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); Console.WriteLine("A new duck house has been created."); Thread.Sleep(2000); }
public void AddDuckHouse(DuckHouse field) { DuckHouses.Add(field); }
public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); Console.WriteLine($"New Duck House has been created!"); Console.ReadLine(); }
public void AddDuckHouse(DuckHouse field) { DuckHouses.Add(field); // Confirmation System.Console.WriteLine($"{field} has been added"); }
public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); Console.WriteLine("Duck House created successfully!"); Console.WriteLine(DuckHouses[DuckHouses.Count - 1]); }
public void AddDuckHouse(DuckHouse DH) { Console.WriteLine("Adding Duck House..."); DuckHouses.Add(DH); }
public void AddDuckHouse(DuckHouse canopy) { DuckHouses.Add(canopy); }
public void AddDuckHouse(DuckHouse duckHouse) { DuckHouses.Add(duckHouse); Console.WriteLine("Your duck house has been purchased."); }
public void AddDuckHouse(DuckHouse house) { DuckHouses.Add(house); }
public void AddDuckHouse(DuckHouse pond) { DuckHomes.Add(pond); }