Alex Block

Alex Block

  • NA
  • 4
  • 0

C# Chat Bot Help

Dec 31 2009 1:36 PM
Hi,
I am building a chat bot using C# and I am having problems with my Text Analyzation method. Can someone please take a look at my code and help me figure out what to do to fix it?

Thanks

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChatBot
{
    class Program
    {
        static public double Intro(string hello)
        {
            Console.WriteLine("Hi, My name is Sid and I would love to talk to you, but first I need to know \n your age", hello);
            Console.WriteLine();
            Console.WriteLine("What is your age:");
            double age = double.Parse(Console.ReadLine());
            return age;
        }
        static public double AgeCalc(double age)
        {
            if (age < 13)
            {
                Console.WriteLine("I am sorry, but I am unable to talk to you");
                Console.ReadLine();
                Console.Clear();
                
            }
            else 
            {
                Console.WriteLine("Great! I would love to talk to you, but I need to know your name");
                
            }
            return age;
        }
        static public string GetName(string UserName)
        {
            Console.WriteLine("Please enter your name:",UserName);
            string name = Console.ReadLine();
            Console.Clear();
            Console.WriteLine("Its nice to meet you {0}", name);
            Console.ReadLine();
            return name;
        }
        static public string Text()
        {
            Console.WriteLine("What would you like to talk about?");
            Console.ReadLine();
            string EInput = Console.ReadLine();
            return EInput;
           
        }
        static public string TextAnalyzer(string EInput)
        {
            if (EInput == "weather")
            {
                Console.WriteLine("I would love to talk about the weather");
                Console.ReadLine();
            }
            return EInput;
        }
        
        static void Main(string[] args)
        {
            double getAge = Intro("Age");
            Console.Clear();
            double CalcAge = AgeCalc((double)getAge);
            Console.ReadLine();
            GetName("Name");
            string ReadText = Text();
            TextAnalyzer((string)ReadText);
            



        }
    }
}
 



Answers (1)