static void Main(string[] args) { var Divisors = new List <Divisor> { new Divisor { Value = 3, Token = "Fizz" }, new Divisor { Value = 7, Token = "Buzz" }, new Divisor { Value = 38, Token = "Bazz" }, }; Console.WriteLine("Press any key to run FizzBuzz with the given parameters:"); Console.WriteLine("Range: -12 to 145"); Console.WriteLine("Multiples of 3: Fizz"); Console.WriteLine("Multiples of 7: Buzz"); Console.WriteLine("Multiples of 38: Bazz"); var fizzBuzz = new SuperFizzBuzz(-12, 145, Divisors); fizzBuzz.display(fizzBuzz.generate()); }
private static void Play() { var min = string.Empty; while (min == string.Empty) { Console.Write("\nPlease enter the first number in the range: "); min = Console.ReadLine(); } var max = string.Empty; while (max == string.Empty) { Console.Write("Please enter the last number in the range: "); max = Console.ReadLine(); } var divisors = new List <Divisor>(); var addAnotherDivisor = true; while (addAnotherDivisor) { var divisor = string.Empty; while (divisor == string.Empty) { Console.Write("Please enter the divisor value: "); divisor = Console.ReadLine(); } var token = string.Empty; while (token == string.Empty) { Console.Write("Please enter the word for this divisor: "); token = Console.ReadLine().Trim(); } divisors.Add(new Divisor { Value = Convert.ToInt32(divisor), Token = token }); addAnotherDivisor = GetMenuInput("Press 1 to enter another, Press 2 to continue: ") == 1; Console.WriteLine(""); } Console.Clear(); var fizzBuzz = new SuperFizzBuzz(Convert.ToInt32(min), Convert.ToInt32(max), divisors); fizzBuzz.display(fizzBuzz.generate()); MainMenu(); }