Ejemplo n.º 1
0
        public void Run(DataWriter dataWriter, DataReader dataReader)
        {
            StudentSystem studentSystem = new StudentSystem();

            while (true)
            {
                string[] commands = dataReader.Read().Split(" ");
                string   command  = commands[0];
                if (command == "Create")
                {
                    string name  = commands[1];
                    int    age   = int.Parse(commands[2]);
                    double grade = double.Parse(commands[3]);
                    studentSystem.Create(name, age, grade);
                }
                else if (command == "Show")
                {
                    string  name    = commands[1];
                    Student student = studentSystem.Get(name);
                    dataWriter.Write(student);
                }
                else if (command == "Exit")
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        static void Main()
        {
            StudentSystem studentSystem = new StudentSystem();

            string input;

            while ((input = Console.ReadLine()) != "Exit")
            {
                string[] args = input.Split();
                if (args[0] == "Create")
                {
                    studentSystem.Create(args[1], int.Parse(args[2]), double.Parse(args[3]));
                }
                else if (args[0] == "Show")
                {
                    studentSystem.Show(args[1]);
                }
            }
        }
Ejemplo n.º 3
0
    public void ParseCommand(string input)
    {
        string[] command = input.Split(new char[] { ' ' }, StringSplitOptions.None).ToArray();

        StudentSystem StudentSystem = new StudentSystem();

        switch (command[0])
        {
        case "Create":
            StudentSystem.Create(command);
            break;

        case "Show":
            StudentSystem.Show(command);
            break;

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