private void SetCourcesCount() { _writer.WriteLine("Enter course count:"); var input = ReadHelper.GetInputRow(_reader); _cources = new Course[ReadHelper.ParseIntSave(input, "Course count")]; }
private void SetStudentsCount() { _writer.WriteLine("Enter students count: "); var input = ReadHelper.GetInputRow(_reader); _students = new Student[ReadHelper.ParseIntSave(input, "Students Count")]; }
static int[] EnterNumbers(IReader reader, IWriter writer) { writer.WriteLine("Enter 2 numbers: "); var input = ReadHelper.GetInputRow(reader); return(ReadHelper.SplitInput(input, 2, " ").Select(e => ReadHelper.ParseIntSave(e, "Number")).ToArray()); }
private static OperationType EnterOperation(IReader reader, IWriter writer) { writer.WriteLine("Enter operation: "); var input = ReadHelper.GetInputRow(reader); OperationType operation; switch (input) { case "+": operation = OperationType.Add; break; case "-": operation = OperationType.Subtract; break; case "*": operation = OperationType.Multiplay; break; default: throw new ArgumentException(); } return(operation); }
private Complex ReadComplexNumber() { var input = ReadHelper.GetInputRow(_reader); var parts = ReadHelper.SplitInput(input, 2, _inputDelimiter); return(new Complex(ReadHelper.ParseIntSave(parts[0], "Complex number real part"), ReadHelper.ParseIntSave(parts[1], "Complex number imaginary part"))); }
private Command ReadCommand() { var input = ReadHelper.GetInputRow(_reader); var command = _commands.FirstOrDefault(c => c.Name.Equals(input, StringComparison.CurrentCultureIgnoreCase)); if (command == null) { throw new ArgumentException("Input must be valid command!"); } return(command); }
private void SetStudentsData() { _writer.WriteLine("Enter students data formated name//courseId"); for (var i = 0; i < _students.Length; i++) { var input = ReadHelper.GetInputRow(_reader); var parts = ReadHelper.SplitInput(input, 2, _inputDelimiter); var student = new Student(parts[0]); _students[i] = student; SignStudentToCourse(student, ReadHelper.ParseIntSave(parts[1], "CourseId")); } }
private void SetTasksData() { _writer.WriteLine("Enter tasks data: studentID//courseID//taskName//score"); while (true) { var input = ReadHelper.GetInputRow(_reader); if (input == _exitCommand) { break; } DoSetTasksData(input); } }
private void SetCoursesData() { _writer.WriteLine("Enter course data formated courseName//duration//capacity"); for (var i = 0; i < _cources.Length; i++) { var input = ReadHelper.GetInputRow(_reader); var parts = ReadHelper.SplitInput(input, 3, _inputDelimiter); _cources[i] = new Course(new CourseArgs() { Name = parts[0], Duration = ReadHelper.ParseIntSave(parts[1], "Duration"), Capability = ReadHelper.ParseIntSave(parts[2], "Capability") }); } }