public void AddDog() { DogCage dogCage = new DogCage(); runInterface.dogCageList.Add(dogCage); AskEnterNewAnimal(); }
//private int askAmount(string animalType) //{ // Console.Write("Enter Amount of %s Cages: ", animalType); // int amount = Console.Read(); // return amount; //} void createDogCages() { DogCage newCage = new DogCage(); newCage.cageID = (++lastCageID); dogCages.Add(newCage); Console.WriteLine(" "); Console.WriteLine("One Dog Cage Added. Total Dog Cages = {0}", dogCages.Count); }
public DogCage getThisDogCage(int cageID) { DogCage adogCage = null; foreach (DogCage aCage in dogCages) { if (aCage.cageID == cageID) { adogCage = aCage; } } return(adogCage); }
public void removeDog(int cageID, Cages theCages) { Dog theDog = null; if (cageID == 0) { throw new System.NotImplementedException("remove Dog no valid cageID"); } DogCage theDogCage = theCages.getThisDogCage(cageID); theDogCage.cageStatus = 0; //set cage to empty so it can be used by another pet. theDog = theDogCage.removeDog(); // remove the Dog object reference from the cage object. Console.WriteLine("Dog {0} is in Cage {1}", theDog.Name, theDog.cageID); theDog.adopted = true; Dogs.Remove(theDog); // remove the Dog object from the list of Dogs }
private void addDog(DogCage aCage) { if (aCage == null) { return; // throw new System.NotImplementedException("addDog no cages null"); } Dog aDog = new Dog(); Console.Write("Enter new dog's name: "); string name = Console.ReadLine(); aDog.Name = name; aDog.cageID = aCage.cageID; aCage.addDog(aDog); Dogs.Add(aDog); }
public DogCage getDogCage() { DogCage adogCage = null; foreach (var aCage in dogCages) { if (aCage.isCageEmpty()) { adogCage = aCage; break; } } if (adogCage == null) { int currxPos = Console.CursorLeft; Console.Write("Sorry. No open cages at this time. Hit a key to continue."); Console.ReadKey(); Console.SetCursorPosition(currxPos - 1, Console.CursorTop); // move the cursor up Nine lines to paint next menu on top. Console.Write(" "); // to erase the last message } return(adogCage); }