예제 #1
0
        public static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();

            while (true)
            {
                string[] input = Console.ReadLine().Split();

                if (input[0] == "Exit")
                {
                    break;
                }

                else if (input[0] == "Create")
                {
                    studentSystem.AddStudent(input);
                }

                else if (input[0] == "Show")
                {
                    var name = input[1];
                    studentSystem.ShowStudent(name);
                }
            }
        }
예제 #2
0
        static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();

            while (true)
            {
                string[] commands = Console.ReadLine().Split();

                if (commands[0] == "Exit")
                {
                    studentSystem.Exit();
                }

                string studentName = commands[1];

                if (commands[0] == "Create")
                {
                    int    studentAge     = int.Parse(commands[2]);
                    double studentAverage = double.Parse(commands[3]);

                    Student currentStudent = new Student(studentName, studentAge, studentAverage);

                    studentSystem.CreateStudent(currentStudent);
                }

                try
                {
                    if (commands[0] == "Show")
                    {
                        Console.WriteLine(studentSystem.ShowStudent(studentName));
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
        }