public static Tree GetStar(Tree PassedInTree) { if (!PassedInTree.GetDescription().Contains("Star")) { PassedInTree = new StarDecoration(PassedInTree); Console.WriteLine("Added a Star to the top of the tree!"); return(PassedInTree); } Console.WriteLine("There is already a bright, shining star on the tree!"); return(PassedInTree); }
public static Tree ChooseDecorations(Tree ChosenTree) { PrintDecorationsMenu(); bool SwitchMenu = true; int MenuChoice; while (SwitchMenu) { MenuChoice = int.Parse(ReadLine()); while (MenuChoice < 0 || MenuChoice > 7) { MenuChoice = int.Parse(ReadLine()); WriteLine("Please enter a valid option"); } switch (MenuChoice) { case 1: ChosenTree = StarDecoration.GetStar(ChosenTree); break; case 2: ChosenTree = new RufflesDecoration(ChosenTree); WriteLine("Added a string of beautiful ruffles to the tree"); break; case 3: ChosenTree = new BallsRedDecoration(ChosenTree); WriteLine("Added a dozen vibrant red baubles to the tree"); break; case 4: ChosenTree = new BallsSilverDecoration(ChosenTree); WriteLine("Added a dozen spectacular silver baubles to the tree"); break; case 5: ChosenTree = new BallsBlueDecoration(ChosenTree); WriteLine("Added a dozen shiny blue baubles to the tree"); break; case 6: ChosenTree = new RibbonsDecoration(ChosenTree); WriteLine("Added a beautiful stream of Ribbons"); break; case 7: ChosenTree = new LightsDecoration(ChosenTree); WriteLine("Added a string of traditional lights"); break; case 8: ChosenTree = new LEDLightsDecoration(ChosenTree); WriteLine("Added a brand new string of LED lights"); break; case 0: SwitchMenu = false; break; default: SwitchMenu = false; break; } } return(ChosenTree); }