public static void Main() { var output = new StringBuilder(); var catalog = new Catalog(); var c = new CommandExecutor(); var commands = ParseCommands(); foreach (var command in commands) { c.ExecuteCommand(catalog, command, output); } Console.Write(output); }
public static void Main(string[] args) { int numberOfCommands = int.Parse(Console.ReadLine()); StringBuilder commandsBuffer = new StringBuilder(); Shop shop = new Shop(); CommandExecutor commandExecutor = new CommandExecutor(shop); for (int i = 0; i < numberOfCommands; i++) { string command = Console.ReadLine(); string commandMessage = commandExecutor.ExecuteCommand(command); commandsBuffer.Append(commandMessage + "\n"); } Console.WriteLine(commandsBuffer.ToString().Trim()); }