static void Main(string[] args)
        {
            Console.WriteLine("Enter your input: ");
            string input = Console.ReadLine();

            string[] inputInfo = input.Split(", ");
            Article  article   = new Article(inputInfo[0], inputInfo[1], inputInfo[2]);

            Console.WriteLine("Enter the number of operations you want to conduct(1-3): ");
            int operations = int.Parse(Console.ReadLine());

            if (operations == 1)
            {
                article.Edit();
            }
            else if (operations == 2)
            {
                article.Edit();
                article.ChangeAuthor();
            }
            else
            {
                article.Edit();
                article.ChangeAuthor();
                article.ChangeTitle();
            }

            Console.WriteLine($"{article.Content} - {article.Author} - {article.Title}");
        }
示例#2
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());
        }
        static void Main(string[] args)
        {
            string[] article = Console.ReadLine().Split(", ").ToArray();
            string   title   = article[0];
            string   content = article[1];
            string   author  = article[2];

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

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

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

                string command = commands[0];

                if (command.Equals("Edit"))
                {
                    myArticle.Edit(commands[1]);
                }
                else if (command.Equals("ChangeAuthor"))
                {
                    myArticle.ChangeAuthor(commands[1]);
                }
                else if (command.Equals("Rename"))
                {
                    myArticle.Rename(commands[1]);
                }
            }

            Console.WriteLine(myArticle);
        }
示例#4
0
        static void Main()
        {
            string[] baseArticle    = Console.ReadLine().Split(", ");
            Article  article        = new Article(baseArticle[0], baseArticle[1], baseArticle[2]);
            int      commandCounter = int.Parse(Console.ReadLine());

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

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

                case "Rename":
                    article.Rename(commandInput[1]);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
示例#5
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[] bookInfo = Console.ReadLine().Split(", ").ToArray();
            int      n        = int.Parse(Console.ReadLine());

            Article newArticle = new Article(bookInfo[0], bookInfo[1], bookInfo[2]);

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

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

            Console.WriteLine(newArticle.ToString());
        }
示例#7
0
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine()
                             .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                             .ToArray();

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

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

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



                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());
        }
        static void Main(string[] args)
        {
            string[] articleTokens = Console.ReadLine().Split(", ").ToArray();
            Article  myArticle     = new Article(articleTokens[0], articleTokens[1], articleTokens[2]);
            int      count         = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                string[] cmdTokens = Console.ReadLine().Split(": ");
                string   cmd       = cmdTokens[0];
                if (cmd == "Edit")
                {
                    myArticle.Edit(cmdTokens[1]);
                }
                else if (cmd == "ChangeAuthor")
                {
                    myArticle.ChangeAuthor(cmdTokens[1]);
                }
                else if (cmd == "Rename")
                {
                    myArticle.Rename(cmdTokens[1]);
                }
            }
            Console.WriteLine(myArticle);
        }
示例#9
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());
        }
示例#10
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());
        }
示例#11
0
        static void Main(string[] args)
        {
            string[] line    = Console.ReadLine().Split(", ");
            Article  article = new Article(line[0], line[1], line[2]);

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

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

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

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

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

            Console.WriteLine(article.ToString());
        }
示例#12
0
        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 n = int.Parse(Console.ReadLine());

            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
                {
                    article.Rename(command[1]);
                }
            }

            Console.WriteLine(article);
        }
示例#13
0
        static void Main()
        {
            string[] article = Console.ReadLine()
                               .Split(", ", StringSplitOptions.RemoveEmptyEntries);

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

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

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

                if (command[0] == "Edit")
                {
                    art.Edit(command[1]);
                }
                else if (command[0] == "ChangeAuthor")
                {
                    art.ChangeAuthor(command[1]);
                }
                else if (command[0] == "Rename")
                {
                    art.Remane(command[1]);
                }
            }

            Console.WriteLine(art);
        }
示例#14
0
        static void Main(string[] args)
        {
            string[] inputArticle = Console.ReadLine().Split(", ");
            Article  art          = new Article(inputArticle[0], inputArticle[1], inputArticle[2]);
            int      n            = int.Parse(Console.ReadLine());

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

                if (command == "Edit")
                {
                    art.Edit(change);
                }
                else if (command == "ChangeAuthor")
                {
                    art.ChangeAuthor(change);
                }
                else if (command == "Rename")
                {
                    art.Rename(change);
                }
            }

            Console.WriteLine(art);
        }
示例#15
0
        static void Main(string[] args)
        {
            // GOTTA SAVE THAT MEMORY
            string[] parameters = Console.ReadLine().Split(", ");

            Article article = new Article(parameters);

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

            for (int i = 0; i < n; n++)
            {
                string command = Console.ReadLine();

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

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

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

            Console.WriteLine(article.ToString());
        }
示例#16
0
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(", ");
            int n     = int.Parse(Console.ReadLine());

            List <Article> articles = new List <Article>();
            Article        article  = new Article();

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

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

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

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

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

                default:
                    break;
                }
            }

            Console.WriteLine(article);
        }
示例#17
0
        static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            Article  article = new Article(input[0], input[1], input[2]);

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

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

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

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

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

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

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

                case "Rename":
                    article.Rename(commands[1]);
                    break;
                }
            }
            Console.WriteLine(article);
        }
示例#19
0
        static void Main(string[] args)
        {
            List <string> input          = Console.ReadLine().Split(", ").ToList();
            int           numberCommands = int.Parse(Console.ReadLine());

            Article publication = new Article(input[0], input[1], input[2]);

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

                if (commandArr.Contains("Edit"))
                {
                    publication.Edit(commandArr[1]);
                }
                else if (commandArr.Contains("ChangeAuthor"))
                {
                    publication.ChangeAuthor(commandArr[1]);
                }
                else if (commandArr.Contains("Rename"))
                {
                    publication.Rename(commandArr[1]);
                }
            }

            Console.WriteLine(publication.ToString());
        }
示例#20
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.ChangeAuthor(argument);
                }
                else if (command == "Rename")
                {
                    article.Rename(argument);
                }
            }
            Console.WriteLine(article);
        }
        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());
        }
示例#22
0
        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());
        }
示例#23
0
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(", ");
            int      num   = 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 < num; i++)
            {
                string[] comand = Console.ReadLine().Split(": ");

                if (comand[0] == "Edit")
                {
                    article.Edit(comand[1]);
                }

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

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

            Console.WriteLine(article.ToString());
        }
示例#24
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);
        }
示例#25
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());
        }
示例#26
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());
            }
        }
示例#27
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}");
        }
示例#28
0
        public static void Main()
        {
            var data    = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
            var title   = data[0];
            var content = data[1];
            var author  = data[2];

            var article = new Article(title, content, author)
            {
                Title   = title,
                Content = content,
                Author  = author
            };

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

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

                if (command[0] == "Edit")
                {
                    var newContent = command[1];
                    article.Edit(newContent);
                }

                else if (command[0] == "ChangeAuthor")
                {
                    var newAuthor = command[1];
                    article.ChangeAuthor(newAuthor);
                }

                else
                {
                    var newTitle = command[1];
                    article.RenameTitle(newTitle);
                }
            }

            Console.WriteLine(article.ToString());
        }
示例#29
0
        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());
        }
示例#30
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());;
        }