public static List <Boat> CreateTheBoats(string boatSelection, int numberOfBoatsToCreate) { //Build the Boat--right now, builds four boats to race but could be changed to //collect a user input to vary the number of boats to race List <Boat> list = new List <Boat>(); for (int i = 0; i < numberOfBoatsToCreate; i++) { if (boatSelection == "Sailboat") { //Create a sailboat SailBoat boat = new SailBoat(1, "sloop", "diesel", 34, false); list.Add(boat);//this the Boat Type list /* * referencing a sailplan is an issue. * Might be solved through a dictionary once name is given. * Name could be key. */ //next line is probably not necessary //boat.RacingBoats.Add(boat);//do I need this? } else if (boatSelection == "Trawler") { //Create a Trawler Trawler boat = new Trawler(1, "diesel", 38, false); list.Add(boat);//this the Boat Type list //boat.racingBoats.Add(boat);//do I need this? } else if (boatSelection == "PontoonBoat") { //Create a Pontoon Boat PontoonBoat boat = new PontoonBoat(2, "gas", 30, true); list.Add(boat);//this the Boat Type list //boat.racingBoats.Add(boat);//do I need this? } else if (boatSelection == "SpeedBoat") { //Create a speedboat SpeedBoat boat = new SpeedBoat(1, "gas", 35, true); list.Add(boat);//this the Boat Type list //boat.racingBoats.Add(boat);//do I need this? } else { Console.WriteLine("You have not selected an available boat."); }; } return(list); }
//public double BoatSpeed { get; set; } public void AddBoats(SailBoat aSailboat) { RacingBoats.Add(aSailboat); }