private string GetNextProblem(ProblemType type) { switch (type) { case ProblemType.Addition: _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.Subtraction: _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.AddSubtract: if (rand.Next(4) >= 2) { _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; case ProblemType.Multiplication: _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.Division: _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.MultiplyDivide: if (rand.Next(4) >= 2) { _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; case ProblemType.All: int randInt = rand.Next(8); if (randInt >= 6) { _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else if (randInt >= 4) { _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else if (randInt >= 2) { _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; } return("Problem Number " + _problems.Count + ": " + Environment.NewLine + Environment.NewLine + _currentMathProblem); }
private string GetNextProblem(ProblemType type) { switch (type) { case ProblemType.Addition: _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.Subtraction: _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.AddSubtract: if (rand.Next(4) >= 2) { _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; case ProblemType.Multiplication: _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.Division: _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); break; case ProblemType.MultiplyDivide: if (rand.Next(4) >= 2) { _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; case ProblemType.All: int randInt = rand.Next(8); if (randInt >= 6) { _currentMathProblem = new MultiplicationProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else if (randInt >= 4) { _currentMathProblem = new DivisionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else if (randInt >= 2) { _currentMathProblem = new AdditionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } else { _currentMathProblem = new SubtractionProblem(GetDifficultyLevel()); _problems.Add(_currentMathProblem); } break; } return "Problem Number " + _problems.Count + ": " + Environment.NewLine + Environment.NewLine + _currentMathProblem; }