Ejemplo n.º 1
0
        //Basic function for compiling messages to send to console,
        // need virtual keyword for polymorphism
        public virtual void Respond(InterfaceHandler _interface)
        {
            List <string> message = new List <string> {
                ReplyMessage, FarewellMessage
            };

            _interface.WriteTo(message);
            _interface.Exit();
        }
Ejemplo n.º 2
0
        public void TellJoke(Random _rand, InterfaceHandler _interface)
        {
            char input = _interface.GetResponse();

            if (input == 'Y' || input == 'y')
            {
                List <string> Joke = GetJoke(_rand);
                Joke.Add("Would you like to hear another joke?");
                _interface.WriteTo(Joke);
                TellJoke(_rand, _interface);
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var Interface = new InterfaceHandler();

            //Greet user
            Interface.Greeting();
            //Get response from user
            char response = Interface.GetResponse();
            //Respond to user, can use any subclass of Feeling
            var     Handler = new ResponseHandler(response);
            Feeling Today   = Handler.Today;

            Today.Respond(Interface);
        }
Ejemplo n.º 4
0
        public override void Respond(InterfaceHandler _interface)
        {
            List <string> First = new List <string> {
                ReplyMessage, "Would a joke cheer you up?", "Press Y for Yes and N for No"
            }; _interface.WriteTo(First);
            Random rand = new Random();

            TellJoke(rand, _interface);
            List <string> Final = new List <string> {
                "That's a no to a joke.", FarewellMessage
            };

            _interface.WriteTo(Final);
            _interface.Exit();
        }