/// <summary> /// Starts the soda machine. /// </summary> public void StartMachine() { while (true) { var userInput = getUserInput(machineManager.GetMoneyInMachine()); if (MachineClientHelper.IsValidCommand(userInput)) { var command = MachineClientHelper.GetCommand(userInput); if (MachineClientHelper.IsValidCommandParameter(userInput, command)) { //If the command is identified and the parameter is valid for the identified command, parse the parameter var commandParameter = MachineClientHelper.GetCommandParameter(userInput, command); machineManager.ExecuteCommand(command, commandParameter); } else { Console.WriteLine("Invalid command option"); } } else { Console.WriteLine("Invalid command"); } } }