Exemple #1
0
        /// <summary>
        /// Start the conversion.
        /// </summary>
        public void Start()
        {
            int  choice;
            char answer;

            ////Adapter instance to access members of that class
            LanguageAdapter languageAdapter = new LanguageAdapter();

            try
            {
                ////Take choice from user
                do
                {
                    Console.WriteLine("***************************");
                    Console.WriteLine("1. Korean To English");
                    Console.WriteLine("2. English To Korean");
                    choice = Convert.ToInt32(Console.ReadLine());
                    switch (choice)
                    {
                    case 1:
                        ////Korean to English
                        Korean korean = new Korean();
                        korean.KoreanChat();
                        break;

                    case 2:
                        ////English to Korean
                        English english = new English();
                        english.EnglishChat();
                        break;

                    default:
                        break;
                    }

                    Console.WriteLine("*********************************************");
                    Console.WriteLine("\nDo you want to continue? (y/n) : ");
                    answer = Convert.ToChar(Console.ReadLine());
                }while (answer == 'y' || answer == 'Y');
                Console.WriteLine("\nThank you....");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Korean language chat.
        /// </summary>
        public void KoreanChat()
        {
            int  choice;
            char answer;

            ////Adapter instance to access members of that class
            LanguageAdapter languageAdapter = new LanguageAdapter();

            try
            {
                do
                {
                    Console.WriteLine("***************************");
                    Console.WriteLine("1. Annyeonghaseyo");
                    Console.WriteLine("2. Dangsin-ui ileum?");
                    Console.WriteLine("3. nae ileum-eun");
                    Console.WriteLine("4. Jal jinaess-eoyo?");
                    Console.WriteLine("5. naneun gwaenchanh-ayo");
                    Console.WriteLine("6. Annyeong");
                    choice = Convert.ToInt32(Console.ReadLine());
                    switch (choice)
                    {
                    case 1:
                        ////Hi
                        Console.WriteLine(languageAdapter.ConvertToEnglish("Annyeonghaseyo"));
                        break;

                    case 2:
                        ////What is your name
                        Console.WriteLine(languageAdapter.ConvertToEnglish("Dangsin-ui ileum?"));
                        break;

                    case 3:
                        ////My name is
                        Console.WriteLine(languageAdapter.ConvertToEnglish("nae ileum-eun"));
                        break;

                    case 4:
                        ////How are you
                        Console.WriteLine(languageAdapter.ConvertToEnglish("Jal jinaess-eoyo?"));
                        break;

                    case 5:
                        ////I am fine
                        Console.WriteLine(languageAdapter.ConvertToEnglish("naneun gwaenchanh-ayo"));
                        break;

                    case 6:
                        ////Bye
                        Console.WriteLine(languageAdapter.ConvertToEnglish("Annyeong"));
                        break;

                    default:
                        return;
                    }

                    Console.WriteLine("*********************************************");
                    Console.WriteLine("\ngyesog hasigessseubnikka? (y/n) : ");
                    answer = Convert.ToChar(Console.ReadLine());
                }while (answer == 'y' || answer == 'Y');
                Console.WriteLine("\nGomabseubnida....");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        /// <summary>
        /// Convert English to korean.
        /// </summary>
        public void EnglishChat()
        {
            int  choice;
            char answer;

            try
            {
                LanguageAdapter languageAdapter = new LanguageAdapter();
                do
                {
                    Console.WriteLine("***************************");
                    Console.WriteLine("1. Hi");
                    Console.WriteLine("2. What is your name?");
                    Console.WriteLine("3. My name is ");
                    Console.WriteLine("4. How are you?");
                    Console.WriteLine("5. I am fine");
                    Console.WriteLine("6. Bye");
                    choice = Convert.ToInt32(Console.ReadLine());

                    ////Calls to convert to korean based on Phrase
                    switch (choice)
                    {
                    case 1:
                        Console.WriteLine(languageAdapter.ConvertToKorean("Hi"));
                        break;

                    case 2:
                        Console.WriteLine(languageAdapter.ConvertToKorean("What is your name?"));
                        break;

                    case 3:
                        Console.WriteLine(languageAdapter.ConvertToKorean("My name is"));
                        break;

                    case 4:
                        Console.WriteLine(languageAdapter.ConvertToKorean("How are you?"));
                        break;

                    case 5:
                        Console.WriteLine(languageAdapter.ConvertToKorean("I am fine"));
                        break;

                    case 6:
                        Console.WriteLine(languageAdapter.ConvertToKorean("Bye"));
                        break;

                    default:
                        return;
                    }

                    Console.WriteLine("*********************************************");
                    Console.WriteLine("\nDo you want to continue? (y/n) : ");
                    answer = Convert.ToChar(Console.ReadLine());
                }while (answer == 'y' || answer == 'Y');
                Console.WriteLine("\nThank you....");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }