Changed the variable name for answers to be consistent across controllers.

This commit is contained in:
Brad Corbett 2020-04-29 12:13:32 +01:00
parent 3af75ebaf7
commit 9bd1330513
2 changed files with 10 additions and 10 deletions

View file

@ -33,7 +33,7 @@ import java.util.*;
public class MatchTheMeaningController extends Question implements Initializable{
private ArrayList<DictionaryEntry> setOfQuestions=new ArrayList<>();
private ArrayList<DictionaryEntry> answer =new ArrayList<>();
private ArrayList<Integer> orderList = new ArrayList<>(Arrays.asList(0,1,2,3));
private boolean isEnglish;
@ -86,7 +86,7 @@ public class MatchTheMeaningController extends Question implements Initializable
*/
private void getQuestions(){
setOfQuestions.addAll(AssessmentGenerator.generateWordMatch());
answer.addAll(AssessmentGenerator.generateWordMatch());
}
@ -147,12 +147,12 @@ public class MatchTheMeaningController extends Question implements Initializable
listOfAnswers.add(LeftWord4.getText());
}
checkAnswer(setOfQuestions,listOfAnswers,isEnglish);
checkAnswer(answer,listOfAnswers,isEnglish);
CorrectAnswer.setText(Integer.toString(correctAnswers));
WrongAnswer.setText(Integer.toString(wrongAnswers));
setOfQuestions.clear();
answer.clear();
this.prepare();
}
@ -162,7 +162,7 @@ public class MatchTheMeaningController extends Question implements Initializable
*/
private void prepare(){
getQuestions();
setWords(setOfQuestions,orderList);
setWords(answer,orderList);
}
@Override

View file

@ -18,12 +18,12 @@ import uk.ac.aber.cs22120.group20.javafx.Application;
* Controller for the translationTest fxml file.
*
* @author Brad Corbett brc9
* @version 0.9
* @version 0.1
*
*/
public class TranslationController extends Question {
private ArrayList<DictionaryEntry> practiceList = new ArrayList<>();
public static DictionaryEntry practiceWord = new DictionaryEntry();
public static DictionaryEntry answer = new DictionaryEntry();
/**
* Represents the word that will be randomly chosen from the practiceList.
@ -67,10 +67,10 @@ public class TranslationController extends Question {
if(AssessmentGenerator.isEnglish){
wordToTranslate.setText(practiceWord.getWelsh());
wordToTranslate.setText(answer.getWelsh());
}
else{
wordToTranslate.setText(practiceWord.getEnglish());
wordToTranslate.setText(answer.getEnglish());
}
}
@ -86,7 +86,7 @@ public class TranslationController extends Question {
usersInput.add(translationBox.getText());
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
correctTranslation.add(practiceList.get(chosenWord));
correctTranslation.add(answer);
checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish);