Beispiel #1
0
        static void Main(string[] args)
        {
            string[] tokens  = Console.ReadLine().Split(", ");
            Article  article = new Article(tokens[0], tokens[1], tokens[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] commArgs = Console.ReadLine().Split(": ");
                string   command  = commArgs[0];
                string   argument = commArgs[1];

                switch (command)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAutor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
        private static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            string   title   = input[0];
            string   content = input[1];
            string   author  = input[2];

            Article article = new Article(title, content, author);

            int numberOfCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberOfCommands; i++)
            {
                string[] commands = Console.ReadLine().Split(": ");

                if (commands[0] == "Edit")
                {
                    article.EditContent(commands[1]);
                }
                else if (commands[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commands[1]);
                }
                else if (commands[0] == "Rename")
                {
                    article.Rename(commands[1]);
                }
            }
            Console.WriteLine(article.ToString());
        }
        static void Main(string[] args)
        {
            List <string> data  = Console.ReadLine().Split(", ").ToList();
            int           value = int.Parse(Console.ReadLine());

            Article article = new Article(data[0], data[1], data[2]);

            for (int i = 0; i < value; i++)
            {
                string[] commandData = Console.ReadLine().Split(": ");
                if (commandData[0] == "Edit")
                {
                    article.Edit(commandData[1]);
                }
                else if (commandData[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commandData[1]);
                }
                else if (commandData[0] == "Rename")
                {
                    article.Rename(commandData[1]);
                }
            }

            Console.WriteLine(article.ToString());
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            List <string> article         = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).ToList();
            int           numberOfChanges = int.Parse(Console.ReadLine());
            Article       newArticle      = new Article(article[0], article[1], article[2]);

            for (int i = 1; i <= numberOfChanges; i++)
            {
                var command        = Console.ReadLine();
                var splitedCommand = command.Split(": ", StringSplitOptions.RemoveEmptyEntries).ToList();

                if (splitedCommand[0] == "Edit")
                {
                    newArticle.Edit(splitedCommand[1]);
                }
                else if (splitedCommand[0] == "ChangeAuthor")
                {
                    newArticle.ChangeAuthor(splitedCommand[1]);
                }
                else
                {
                    newArticle.Rename(splitedCommand[1]);
                }
            }

            Console.WriteLine(newArticle.ToString());
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries);
            int      n     = int.Parse(Console.ReadLine());

            Article article = new Article(token[0], token[1], token[2]);

            for (int i = 0; i < n; i++)
            {
                string[] input    = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);
                string   comand   = input[0];
                string   argument = input[1];

                switch (comand)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string[] tokens  = Console.ReadLine().Split(", ");
            Article  article = new Article(tokens[0], tokens[1], tokens[2]);
            int      count   = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                string[] input   = Console.ReadLine().Split(": ");
                string   command = input[0];
                if (command == "Edit")
                {
                    article.Edit(input[1]);
                }
                else if (command == "ChangeAuthor")
                {
                    article.ChangeAuthor(input[1]);
                }
                else
                {
                    article.Rename(input[1]);
                }
            }
            Console.WriteLine(article);
        }
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            string[] elements = input.Split(", ", StringSplitOptions.RemoveEmptyEntries).ToArray();

            Article article = new Article(elements[0], elements[1], elements[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                string   command  = Console.ReadLine();
                string[] commands = command.Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                if (commands[0] == "Edit")
                {
                    article.Edit(commands[1]);
                }
                else if (commands[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commands[1]);
                }
                else if (commands[0] == "Rename")
                {
                    article.Rename(commands[1]);
                }
            }

            Console.WriteLine(article.ToString());
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            var data = Console.ReadLine().
                       Split(", ", StringSplitOptions.RemoveEmptyEntries).  // прочитане не първоначалните стойности;
                       ToArray();

            string title   = data[0];
            string content = data[1];
            string author  = data[2];

            Article article = new Article(title, content, author); // създавам обект от клас Article с първоначaлните стойности;

            int commandsCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < commandsCount; i++)
            {
                var command = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                switch (command[0])
                {
                case "Edit": article.Edit(command[1]); break;

                case "ChangeAuthor": article.ChangeAuthor(command[1]); break;

                case "Rename": article.Rename(command[1]); break;
                }
            }
            Console.WriteLine(article.ToString());
        }
        static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            int      n       = int.Parse(Console.ReadLine());
            Article  article = new Article(input[0], input[1], input[2]);

            for (int i = 0; i < n; i++)
            {
                string[] command = Console.ReadLine().Split(": ");
                string   action  = command[0];
                switch (action)
                {
                case "Edit":
                    article.Edit(command[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(command[1]);
                    break;

                case "Rename":
                    article.Rename(command[1]);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            string[] articleTokens = Console.ReadLine().Split(", ");
            Article  myArticle     = new Article(articleTokens[0], articleTokens[1], articleTokens[2]);

            int count = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                string[] comand = Console.ReadLine().Split(": ");
                string   cmd    = comand[0];

                if (cmd == "Edit")
                {
                    myArticle.Edit(comand[1]);
                }
                else if (cmd == "ChangeAuthor")
                {
                    myArticle.ChangeAuthor(comand[1]);
                }
                else if (cmd == "Rename")
                {
                    myArticle.Rename(comand[1]);
                }
            }
            Console.WriteLine(myArticle.ToString());
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            string[] articleData = Console.ReadLine().Split(", ");

            Article article = new Article
            {
                Title   = articleData[0],
                Content = articleData[1],
                Author  = articleData[2]
            };

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] commandParts = Console.ReadLine()
                                        .Split(": ");

                string command  = commandParts[0];
                string argument = commandParts[1];
                if (command == "Edit")
                {
                    article.Edit(argument);
                }
                else if (command == "ChangeAuthor")
                {
                    article.ChangeAutrhor(argument);
                }
                else
                {
                    article.Rename(argument);
                }
            }
            Console.WriteLine(article);
        }
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries)
                        .ToArray();
            Article article = new Article(input[0], input[1], input[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                var command = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                switch (command[0])
                {
                case "Edit":
                    article.Edit(command[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(command[1]);
                    break;

                case "Rename":
                    article.Rename(command[1]);
                    break;
                }
            }


            Console.WriteLine(article.ToString());
        }
        static void Main(string[] args)
        {
            string[] readArticle   = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).ToArray();
            int      countCommands = int.Parse(Console.ReadLine());
            Article  article       = new Article(readArticle[0], readArticle[1], readArticle[2]);

            for (int i = 0; i < countCommands; i++)
            {
                string[] commands = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();
                switch (commands[0])
                {
                case "Edit":
                    article.Edit(commands[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAutho(commands[1]);
                    break;

                case "Rename":
                    article.Rename(commands[1]);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            int      n       = int.Parse(Console.ReadLine());
            Article  article = new Article();

            article.Title   = input[0];
            article.Content = input[1];
            article.Author  = input[2];

            for (int i = 0; i < n; i++)
            {
                string[] command = Console.ReadLine().Split(": ");

                if (command[0] == "Edit")
                {
                    article.Edit(command[1]);
                }
                else if (command[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(command[1]);
                }
                else if (command[0] == "Rename")
                {
                    article.Rename(command[1]);
                }
            }
            Console.WriteLine(article.ToString());
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            string text = Console.ReadLine();

            string[] arrayString = text.Split(", ");



            Article article = new Article(arrayString[0], arrayString[1], arrayString[2]);



            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string   comand      = Console.ReadLine();
                string[] comandArray = comand.Split(": ");
                string   takeCommand = comandArray[0];



                string takeValue = comandArray[1];

                switch (takeCommand)
                {
                case "Edit":
                {
                    article.Edit(takeValue);
                    break;
                }

                case "ChangeAuthor":
                {
                    article.ChangeAuthor(takeValue);
                    break;
                }

                case "Rename":
                {
                    article.Rename(takeValue);
                    break;
                }
                }
            }
            Console.WriteLine(article);
        }
Beispiel #16
0
        static void Main()
        {
            string[] articleInfo = Console.ReadLine()
                                   .Split(", ", StringSplitOptions.RemoveEmptyEntries);

            string title    = articleInfo[0];
            string constent = articleInfo[1];
            string author   = articleInfo[2];

            Article article = new Article(title, constent, author);

            int changesCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < changesCount; i++)
            {
                string[] commands = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);

                string command = commands[0];

                switch (command)
                {
                case "Edit":
                    string newContent = commands[1];
                    article.Edit(newContent);
                    break;

                case "ChangeAuthor":
                    string newAuthor = commands[1];
                    article.ChangeAuthor(newAuthor);
                    break;

                case "Rename":
                    string newTitle = commands[1];
                    article.Rename(newTitle);
                    break;

                default:
                    Console.WriteLine("Invalid command!");
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            string[] articleArgs = Console.ReadLine()
                                   .Split(',');

            string title   = articleArgs[0];
            string content = articleArgs[1];
            string author  = articleArgs[2];

            Article article = new Article(title, content, author);

            int countOfCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < countOfCommands; i++)
            {
                string[] commandArgs = Console.ReadLine()
                                       .Split(':');

                string command = commandArgs[0];
                string value   = commandArgs[1];

                if (command == "Edit")
                {
                    string currentContent = commandArgs[1];
                    article.Edit(currentContent);
                }

                else if (command == "ChangeAuthor")
                {
                    string currentAuthor = commandArgs[1];
                    article.ChangeAuthor(currentAuthor);
                }

                else if (command == "Rename")
                {
                    string currentTitle = commandArgs[1];
                    article.Rename(currentTitle);
                }
            }

            Console.WriteLine($"{article.Title} - {article.Content}: {article.Author}");
        }
Beispiel #18
0
        static void Main(string[] args)
        {
            var articleData = Console.ReadLine()?.Split(",");

            if (articleData != null && articleData.Length == 3)
            {
                var article = new Article(articleData[0].Trim(), articleData[1].Trim(), articleData[2].Trim());

                int commandCount = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
                for (int commandIndex = 0; commandIndex < commandCount; commandIndex++)
                {
                    string[] command = Console.ReadLine()?.Split(":");
                    if (command == null || command.Length != 2)
                    {
                        throw new InvalidProgramException(nameof(command));
                    }

                    var methodName     = command[0].Trim();
                    var methodArgument = command[1].Trim();

                    switch (methodName.ToLower())
                    {
                    case "edit":
                        article.Edit(methodArgument);
                        break;

                    case "changeauthor":
                        article.ChangeAuthor(methodArgument);
                        break;

                    case "rename":
                        article.Rename(methodArgument);
                        break;

                    default:
                        break;
                    }
                }

                Console.WriteLine(article.ToString());
            }
        }
        static void Main(string[] args)
        {
            var articles = Console.ReadLine()
                           .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                           .ToList();

            var title   = articles[0];
            var content = articles[1];
            var author  = articles[2];

            var article = new Article(title, content, author);

            var n = int.Parse(Console.ReadLine());

            for (var i = 1; i <= n; i++)
            {
                var tokens = Console.ReadLine()
                             .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                             .ToArray();

                var command  = tokens[0];
                var argument = tokens[1];

                switch (command)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            string[] articleData = Console.ReadLine()
                                   .Split(", ")
                                   .ToArray();
            int n = int.Parse(Console.ReadLine());

            string title   = articleData[0];
            string content = articleData[1];
            string author  = articleData[2];

            Article article = new Article(title, content, author);

            for (int i = 0; i < n; i++)
            {
                string[] tokens  = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);
                string   command = tokens[0];

                if (command == "Edit")
                {
                    string newContent = tokens[1];
                    article.Edit(newContent);
                }
                else if (command == "ChangeAuthor")
                {
                    string newAuthor = tokens[1];
                    article.ChangeAuthor(newAuthor);
                }
                else if (command == "Rename")
                {
                    string newTitle = tokens[1];
                    article.Rename(newTitle);
                }
                else if (command == "ToString")
                {
                    author.ToString();
                }
            }
            Console.WriteLine(article.ToString());;
        }
        static void Main(string[] args)
        {
            string[] article = Console.ReadLine()
                               .Split(", ", StringSplitOptions.RemoveEmptyEntries);

            Article x = new Article();

            x.Title   = article[0];
            x.Content = article[1];
            x.Author  = article[2];

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] cmd = Console.ReadLine()
                               .Split(": ", StringSplitOptions.RemoveEmptyEntries);
                //Edit: better content
                switch (cmd[0])
                {
                case "Edit":
                    Article.Edit(x, cmd[1]);
                    break;

                case "ChangeAuthor":
                    Article.ChangeAuthor(x, cmd[1]);
                    break;

                case "Rename":
                    Article.Rename(x, cmd[1]);
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine(x.ToString());
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            var articleArgsInput = Console.ReadLine().Split(", ").ToArray();
            var articleTitle     = articleArgsInput[0];
            var articleContent   = articleArgsInput[1];
            var articleAuthor    = articleArgsInput[2];

            var article = new Article(articleTitle, articleContent, articleAuthor);

            var modifyingArticleOperationsCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < modifyingArticleOperationsCount; i++)
            {
                var currentOperation = Console.ReadLine()
                                       .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                                       .ToArray();

                var curCommand             = currentOperation[0];
                var articleElementNewValue = currentOperation[1];

                switch (curCommand)
                {
                case "Edit":
                    article.Edit(articleElementNewValue);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(articleElementNewValue);
                    break;

                case "Rename":
                    article.Rename(articleElementNewValue);
                    break;
                }
            }

            Console.WriteLine(article);
        }
Beispiel #23
0
        static void Main(string[] args)
        {
            string[] articleProps = Console.ReadLine().Split(", ");

            string title   = articleProps[0];
            string content = articleProps[1];
            string author  = articleProps[2];

            Article article = new Article(title, content, author);

            int commandCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < commandCount; i++)
            {
                string[] splittedInput = Console.ReadLine().Split(": ");
                string   command       = splittedInput[0];

                if (command == "Edit")
                {
                    string newContent = splittedInput[1];

                    article.Edit(newContent);
                }
                else if (command == "ChangeAuthor")
                {
                    string newAuthor = splittedInput[1];

                    article.ChangeAuthor(newAuthor);
                }
                else if (command == "Rename")
                {
                    string newName = splittedInput[1];

                    article.Rename(newName);
                }
            }
            Console.WriteLine(article);
        }
Beispiel #24
0
        public static void Main(string[] args)
        {
            string[] tockens = Console.ReadLine().Split(", ");
            string   title   = tockens[0];
            string   content = tockens[1];
            string   author  = tockens[2];

            var article = new Article(title, content, author);

            int count = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                string[] input   = Console.ReadLine().Split(": ");
                string   command = input[0];

                if (command == "Edit")
                {
                    string newContent = input[1];

                    article.Edit(newContent);
                }
                else if (command == "ChangeAuthor")
                {
                    string newAuthor = input[1];

                    article.ChangeAuthor(newAuthor);
                }
                else if (command == "Rename")
                {
                    string newTitle = input[1];

                    article.Rename(newTitle);
                }
            }
            System.Console.WriteLine(article);
        }
        static void Main(string[] args)
        {
            string[] article = Console.ReadLine()
                               .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                               .ToArray();
            int numberOfOperations = int.Parse(Console.ReadLine());

            string title   = article[0];
            string content = article[1];
            string author  = article[2];

            Article articles = new Article(title, content, author);

            for (int i = 0; i < numberOfOperations; i++)
            {
                string[] cmdArgs = Console.ReadLine()
                                   .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                                   .ToArray();
                string currentCommand = cmdArgs[0];
                string option         = cmdArgs[1];

                if (currentCommand == "Edit")
                {
                    articles.Edit(option);
                }
                else if (currentCommand == "ChangeAuthor")
                {
                    articles.ChangeAuthor(option);
                }
                else if (currentCommand == "Rename")
                {
                    articles.Rename(option);
                }
            }
            Console.WriteLine(articles.ToString());
        }