public static void game() { Quizelement quiz = CreationOfQuestionAndAnswers(); Console.WriteLine("What do you want to do ?"); Console.WriteLine(player.playerName + "'s Score is: " + player.score); Console.WriteLine("1. Answer Questions 2. Create Questions 3. Exit"); string mode = Console.ReadLine(); switch (mode) { case "1": quiz.show(); Console.WriteLine("Welche Nummer ist richtig ?"); int userInput = Int32.Parse(Console.ReadLine()); quiz.IsAnswerCorrect(userInput, player); game(); break; case "2": CreateOwnQuestions(); game(); break; default: Console.WriteLine("Alright. You finished with a score of " + player.score + " points, I hope I'll see you again soon"); break; } }
public static void CreateOwnQuestions() { Quizelement newQuiz = new Quizelement(); Console.WriteLine("Please write down your question"); string newQuestion = Console.ReadLine(); newQuiz.question = newQuestion; Console.WriteLine("How many answers would you like to add ?"); int amountOfAnswers = Int32.Parse(Console.ReadLine()); newQuiz.answers = new Answer[amountOfAnswers]; for (int i = 0; i < amountOfAnswers; i++) { Console.WriteLine("Please insert an answer"); string userAnswer = Console.ReadLine(); Console.WriteLine("Is this Answer correct ? Please insert Yes or No"); string userAnswerTruth = Console.ReadLine(); bool finalTruth; if (userAnswerTruth == "yes") { finalTruth = true; } else { finalTruth = false; } newQuiz.answers[i] = new Answer { text = userAnswer, truth = finalTruth }; } listWithAllQuestionsAndAnswers.Add(newQuiz); }
public static Quizelement GetRandomQuestion(List <Quizelement> _listWithAllQuestionsAndAnswers) { Random rnd = new Random(); int randomNumber = rnd.Next(_listWithAllQuestionsAndAnswers.Count); Quizelement randomQuestion = _listWithAllQuestionsAndAnswers[randomNumber]; return(randomQuestion); }
public void FragenAusgabe(int i, int score) { Console.WriteLine("Deine beantworteten Fragen: " + i); Console.WriteLine("Deine Punktzahl: " + score); Quizelement quiz1 = new Quizelement(); quiz1.question = "Wer war der erste Bundeskanzler der BDR?"; Quizelement quiz2 = new Quizelement(); quiz2.question = "Welche Farbe entsteht, wenn man Rot und Gelb mischt?"; Quizelement quiz3 = new Quizelement(); quiz3.question = "Wie heißt der kleinste Vogel?"; Quizelement quiz4 = new Quizelement(); quiz4.question = "Wieviel Millimeter hat ein Meter?"; Quizelement quiz5 = new Quizelement(); quiz5.question = "Wie heißt der Freund von Biene Maja? "; Quizelement quiz6 = new Quizelement(); quiz6.question = "Wie heißen halblange Hose?"; Quizelement quiz7 = new Quizelement(); quiz7.question = "Wie lange braucht das Licht in etwa von der Sonne zur Erde?"; string[] question = new string[7]; question[0] = quiz1.question; question[1] = quiz2.question; question[2] = quiz3.question; question[3] = quiz4.question; question[4] = quiz5.question; question[5] = quiz6.question; question[6] = quiz7.question; if (i < question.Length) { Console.WriteLine(question[i]); Answers a = new Answers(); a.AntwortenAusgabe(i, score); } if (i == 7) { Console.WriteLine("Ende des Programms"); } }
public static void Antworterstellen(int anzahl, int i, int score) { int r = 0; while (r < anzahl) { Console.WriteLine("Tippe deine Antwortmöglichkeit/en ein:"); string AntwortEingabe = Console.ReadLine(); r++; } Quizelement.AbfrageWasErMachenWill(i, score); }
public static void AnswerQuestion(Quizelement quizelements) { quizelements.Show(); Console.Write("\nBitte eine Antwort wählen "); int AnswerChoice = int.Parse(Console.ReadLine()) - 1; if (quizelements.answers[AnswerChoice].IsAnswerCorrect()) { score += 1; Console.Write("\nRichtig\n"); } else { Console.Write("\nFalsch\n"); } }
public void AntwortenAusgabe(int i, int score) { Quizelement quiz1 = new Quizelement(); quiz1.answers = new string[4] { "Barak Obama ", "Helmut Kohl ", "Konrad Adenauer ", "Angela Merkel " }; Quizelement quiz2 = new Quizelement(); quiz2.answers = new string[2] { "Orange ", "Gelb " }; Quizelement quiz3 = new Quizelement(); quiz3.answers = new string[5] { "Bachstelze ", "Amsel ", "Kolibri ", "Grünfink ", "Kleiber " }; Quizelement quiz4 = new Quizelement(); quiz4.answers = new string[4] { "100", "1000", "10.000", "10" }; Quizelement quiz5 = new Quizelement(); quiz5.answers = new string[6] { "Puck", "Flip", "Willie", "Turka", "Thekla", "Fridolin" }; Quizelement quiz6 = new Quizelement(); quiz6.answers = new string[2] { "Bahamas", "Bermudas" }; Quizelement quiz7 = new Quizelement(); quiz7.answers = new string[6] { "es ist sofort da", "8 Jahre", "8 Minuten", "8 Tage", "8 Sekunden", "8 Millisekunden" }; if (i == 0) { foreach (string z in quiz1.answers) { System.Console.Write("{0} ", z); } } if (i == 1) { foreach (string z in quiz2.answers) { System.Console.Write("{0} ", z); } } if (i == 2) { foreach (string z in quiz3.answers) { System.Console.Write("{0} ", z); } } if (i == 3) { foreach (string z in quiz4.answers) { System.Console.Write("{0} ", z); } } if (i == 4) { foreach (string z in quiz5.answers) { System.Console.Write("{0} ", z); } } if (i == 5) { foreach (string z in quiz6.answers) { System.Console.Write("{0} ", z); } } if (i == 6) { foreach (string z in quiz7.answers) { System.Console.Write("{0} ", z); } } if (i == 7) { Quizelement.AbfrageWasErMachenWill(i, score); } Console.WriteLine("Schreibe die richtige Antwort:"); string eingabe = Console.ReadLine(); Quizelement q = new Quizelement(); q.IsAnswerCorrect(eingabe, i, score); }
public static Quizelement CreationOfQuestionAndAnswers() { Quizelement quiz = new Quizelement(); quiz.question = "Wer war der erste Bundeskanzler der BRD ?"; quiz.answers = new Answer[4]; quiz.answers[0] = new Answer { text = "Barack Obama", truth = false }; quiz.answers[1] = new Answer { text = "Helmut Kohl", truth = false }; quiz.answers[2] = new Answer { text = "Konrad Adenauer", truth = true }; quiz.answers[3] = new Answer { text = "Angela Merkel", truth = false }; Quizelement quiz2 = new Quizelement(); quiz2.question = "Macht dieses Quiz Spaß ?"; quiz2.answers = new Answer[2]; quiz2.answers[0] = new Answer { text = "Ja", truth = true }; quiz2.answers[1] = new Answer { text = "Nein", truth = false }; Quizelement quiz3 = new Quizelement(); quiz3.question = "In Welchem Spiel spielt man die Hauptheldin 2B ?"; quiz3.answers = new Answer[6]; quiz3.answers[0] = new Answer { text = "Yakuza Kiwami", truth = false }; quiz3.answers[1] = new Answer { text = "DragonQuest 11", truth = false }; quiz3.answers[2] = new Answer { text = "Final fantasy 15", truth = false }; quiz3.answers[3] = new Answer { text = "Nier: Automata", truth = true }; quiz3.answers[4] = new Answer { text = "Persona 5", truth = false }; quiz3.answers[5] = new Answer { text = "Yakuza 6", truth = false }; listWithAllQuestionsAndAnswers.Add(quiz); listWithAllQuestionsAndAnswers.Add(quiz2); listWithAllQuestionsAndAnswers.Add(quiz3); Quizelement questionToDisplay = GetRandomQuestion(listWithAllQuestionsAndAnswers); return(questionToDisplay); }