Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //Console.WriteLine(Constants.DisplayName);
            //Thread.Sleep(3000);

            do
            {
                var manager  = new TestManager();
                var provider = new VocableProvider();

                Console.Clear();
                MenüTextAnzeigen();
                keyInput = Console.ReadLine();

                switch (keyInput)
                {
                case "g":
                    generatedVocables = provider.GetVocablesForTest();
                    Console.WriteLine("Test generated!");
                    break;

                case "s":
                    if (!generatedVocables.Any())
                    {
                        Console.WriteLine("Generate Vocables before starting a Test!");
                        Thread.Sleep(1000);
                        break;
                    }
                    Console.WriteLine("Test started!");
                    Console.Clear();
                    manager.DoTheTest(provider, generatedVocables);
                    Thread.Sleep(1000);
                    break;

                case "b":
                    break;

                default:
                    Console.WriteLine("Unbekannte Eingabe");
                    break;
                }
            } while (keyInput != null && keyInput.ToLower() != "b");
        }
Ejemplo n.º 2
0
        public void DoTheTest(VocableProvider vocableprovider, Dictionary <int, string> generatedVocables)
        {
            StartSequence();

            foreach (var vocable in generatedVocables)
            {
                Console.Clear();
                Console.WriteLine("Please type down the missing forms of the irregular verb:\n" +
                                  $"\t{vocable.Value.ToUpper()}");

                var wrongAnswere = new WrongAnswer
                {
                    Key       = vocable.Key,
                    Infinitiv = vocable.Value
                };

                var entry = Console.ReadLine();

                var splitEntry = entry.Split(null);

                var simplePastEntry     = splitEntry[0].ToLower();
                var pastParticipleEntry = splitEntry[1].ToLower();
                var translation         = splitEntry[2].ToLower();

                if (simplePastEntry == vocableprovider.simplePastArray[vocable.Key])
                {
                    Points += 1;
                }
                else
                {
                    wrongAnswere.EnteredSimplePast = simplePastEntry;
                }

                if (pastParticipleEntry == vocableprovider.pastParticibleArray[vocable.Key])
                {
                    Points += 1;
                }
                else
                {
                    wrongAnswere.EnteredPastParticiple = pastParticipleEntry;
                }

                if (translation == vocableprovider.deutscheÜbersetzung[vocable.Key])
                {
                    Points += 1;
                }
                else
                {
                    wrongAnswere.EnteredTranslation = translation;
                }

                if (wrongAnswere.EnteredSimplePast != null || wrongAnswere.EnteredPastParticiple != null || wrongAnswere.EnteredTranslation != null)
                {
                    ListOfWrongAnswers.Add(wrongAnswere);
                }
            }
            Grade = CalculateGrade(Points);

            Console.WriteLine("Great! You finished the Test!" +
                              "Your grade is being calculated...");
            Thread.Sleep(2000);

            Console.Clear();
            Console.WriteLine($"Your grade: {Grade}\n");

            if (ListOfWrongAnswers.Count > 0)
            {
                Console.WriteLine("Your mistakes:\n\n");
                Console.WriteLine("INFINITIV\t| SIMPLE PAST\t| PARTICIPLE\t| TRANSLATION");
                Console.WriteLine("________________|_______________|_______________|_____________");

                foreach (var wrongAnswer in ListOfWrongAnswers)
                {
                    Console.WriteLine($"{wrongAnswer.Infinitiv}\t\t|\t{wrongAnswer.EnteredSimplePast}\t|\t{wrongAnswer.EnteredPastParticiple}\t|\t{wrongAnswer.EnteredTranslation}");
                }
            }
            Console.WriteLine("\n\nPress Enter to continue....");

            Console.ReadKey();
        }