Esempio n. 1
0
        static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();
            string        input         = Console.ReadLine();

            while (input != "Exit")
            {
                string[] args    = input.Split();
                var      command = args[0];
                var      name    = args[1];

                switch (command)
                {
                case "Create":
                    var age   = int.Parse(args[2]);
                    var grade = double.Parse(args[3]);
                    studentSystem.Create(name, age, grade);
                    break;

                case "Show":
                    studentSystem.Show(name);
                    break;

                case "Exit":
                    Environment.Exit(0);
                    break;

                default:
                    break;
                }
                input = Console.ReadLine();
            }
        }
Esempio n. 2
0
        static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();
            Parser        parser        = new Parser();

            while (true)
            {
                string[] arguments = parser.ParseCommand();
                string   extion    = arguments[0];

                if (extion == "Create")
                {
                    string name  = arguments[1];
                    int    age   = int.Parse(arguments[2]);
                    double grade = double.Parse(arguments[3]);

                    studentSystem.Add(name, age, grade);
                }
                else if (extion == "Show")
                {
                    string name = arguments[1];
                    Console.WriteLine(studentSystem.Show(name));
                }
                else if (extion == "Exit")
                {
                    break;
                }
            }
        }
Esempio n. 3
0
 public void Action(string[] commandArr)
 {
     if (commandArr[0] == "Create")
     {
         studentSystem.Create(commandArr[1], commandArr[2], commandArr[3]);
     }
     else if (commandArr[0] == "Show")
     {
         string name = commandArr[1];
         studentSystem.Show(name);
     }
 }
Esempio n. 4
0
        static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();

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

                if (args[0] == "Create")
                {
                    studentSystem.Create(args);
                }
                else if (args[0] == "Show")
                {
                    studentSystem.Show(args);
                }
                else if (args[0] == "Exit")
                {
                    studentSystem.Exit();
                }
            }
        }