From becf069f04e803b94150d0aa72626c13e9095316 Mon Sep 17 00:00:00 2001 From: maj83 Date: Thu, 30 Apr 2020 12:39:44 +0100 Subject: [PATCH] Changed checkAnswer method. --- .../javafx/MatchTheMeaningController.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/MatchTheMeaningController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/MatchTheMeaningController.java index 48b33cc..23668f6 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/MatchTheMeaningController.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/MatchTheMeaningController.java @@ -133,20 +133,30 @@ public class MatchTheMeaningController extends SharedCodeController { */ public void checkAnswers(){ + ArrayList answers = new ArrayList<>(); ArrayList listOfAnswers = new ArrayList<>(); + + answers.add(answer.get(Integer.parseInt(word1.getValue())-1)); + answers.add(answer.get(Integer.parseInt(word2.getValue())-1)); + answers.add(answer.get(Integer.parseInt(word3.getValue())-1)); + answers.add(answer.get(Integer.parseInt(word4.getValue())-1)); + if(isEnglish){ - listOfAnswers.add(RightWord1.getText()); - listOfAnswers.add(RightWord2.getText()); - listOfAnswers.add(RightWord3.getText()); - listOfAnswers.add(RightWord4.getText()); - }else { listOfAnswers.add(LeftWord1.getText()); listOfAnswers.add(LeftWord2.getText()); listOfAnswers.add(LeftWord3.getText()); listOfAnswers.add(LeftWord4.getText()); + + + }else { + listOfAnswers.add(RightWord1.getText()); + listOfAnswers.add(RightWord2.getText()); + listOfAnswers.add(RightWord3.getText()); + listOfAnswers.add(RightWord4.getText()); + } - Question.checkAnswer(answer,listOfAnswers,isEnglish); + Question.checkAnswer(answers,listOfAnswers,isEnglish); answer.clear();