diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/Application.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/Application.java
index edcfcc1..971657c 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/Application.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/Application.java
@@ -1,5 +1,5 @@
/**
- * @(#) Application.java 0,2 2020/04/30
+ * @(#) Application.java 0,2 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/DictionaryController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/DictionaryController.java
index 41e1313..7baf20e 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/DictionaryController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/DictionaryController.java
@@ -1,5 +1,5 @@
/**
- * @(#) DictionaryController.java 0,1 2020/04/07
+ * @(#) DictionaryController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/FlashcardController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/FlashcardController.java
index 3e182b5..60d7a9e 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/FlashcardController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/FlashcardController.java
@@ -1,5 +1,5 @@
/**
- * @(#) FlashcardController.java 0,1 2020/05/07
+ * @(#) FlashcardController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/MatchTheMeaningController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/MatchTheMeaningController.java
index 8c0056b..d43f17a 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/MatchTheMeaningController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/MatchTheMeaningController.java
@@ -1,5 +1,5 @@
/**
- * @(#) MatchTheMeaningController.java 0,1 2020/04/07
+ * @(#) MatchTheMeaningController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/PracticeListController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/PracticeListController.java
index 907ea40..73b9bef 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/PracticeListController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/PracticeListController.java
@@ -1,5 +1,5 @@
/**
- * @(#) PracticeListController.java 0.2 2020/04/30
+ * @(#) PracticeListController.java 0.2 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/ScreenSwitch.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/ScreenSwitch.java
index 02250f4..80c1740 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/ScreenSwitch.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/ScreenSwitch.java
@@ -1,5 +1,5 @@
/**
- * @(#) ScreenSwitch.java 0.1 2020/04/07
+ * @(#) ScreenSwitch.java 0.1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SharedCodeController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SharedCodeController.java
index 3aa65bd..aa199af 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SharedCodeController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SharedCodeController.java
@@ -1,5 +1,5 @@
/**
- * @(#) FlashcardController.java 0,1 2020/05/07
+ * @(#) SharedCodeController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SixMeaningsController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SixMeaningsController.java
index 1aac79d..52231a6 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SixMeaningsController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/SixMeaningsController.java
@@ -1,5 +1,5 @@
/**
- * @(#) SixMeaningsController.java 0,1 2020/04/27
+ * @(#) SixMeaningsController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
@@ -10,7 +10,6 @@ package uk.ac.aber.cs221.group20.javafx;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
-import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import uk.ac.aber.cs221.group20.json.DictionaryEntry;
@@ -50,7 +49,7 @@ public class SixMeaningsController extends SharedCodeController {
private final ArrayList wordSet = new ArrayList<>();
private final ArrayList orderList = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5));
- private String wordCounterpart;
+ private String wordCounterPart;
private final boolean isEnglish = AssessmentGenerator.isEnglish();
@FXML
@@ -85,100 +84,12 @@ public class SixMeaningsController extends SharedCodeController {
// //////// //
/**
- * Event that runs when the user clicks the first answer from the six options.
+ * Method that intialises 'sixmeanings.fxml' by setting up the menu and also setting the question words onto the screen.
+ * This method is called automatically when 'sixmeanings.fxml' runs.
+ *
+ * @see SharedCodeController
+ * @see AssessmentGenerator
*/
- @FXML
- void answer1() {
- wordCounterpart = possibleAnswer1.getText();
- checkAnswers();
- }
-
- @FXML
- void answer2() {
- wordCounterpart = possibleAnswer2.getText();
- checkAnswers();
- }
-
- @FXML
- void answer3() {
- wordCounterpart = possibleAnswer3.getText();
- checkAnswers();
- }
-
- @FXML
- void answer4() {
- wordCounterpart = possibleAnswer4.getText();
- checkAnswers();
- }
-
- @FXML
- void answer5() {
- wordCounterpart = possibleAnswer5.getText();
- checkAnswers();
- }
-
- @FXML
- void answer6() {
- wordCounterpart = possibleAnswer6.getText();
- checkAnswers();
- }
-
-
- public void setWords(ArrayList questions, ArrayList orderList) {
-
- if (isEnglish) {
-
- wordSet.add(questions.get(0));
-
- //WelshWord1 Is the question word and as a result is always right.
- wordToTranslate.setText(wordSet.get(0).getEnglish());
- //This stores the correct answer for the english word.
-
- Collections.shuffle(orderList);
-
- possibleAnswer1.setText(questions.get(orderList.get(0)).getWelsh());
- possibleAnswer2.setText(questions.get(orderList.get(1)).getWelsh());
- possibleAnswer3.setText(questions.get(orderList.get(2)).getWelsh());
- possibleAnswer4.setText(questions.get(orderList.get(3)).getWelsh());
- possibleAnswer5.setText(questions.get(orderList.get(4)).getWelsh());
- possibleAnswer6.setText(questions.get(orderList.get(5)).getWelsh());
- } else {
-
- wordSet.add(questions.get(0));
- //WelshWord1 Is the question word and as a result is always right.
- wordToTranslate.setText(wordSet.get(0).getWelsh());
- //This stores the correct answer for the english word.
-
- Collections.shuffle(orderList);
-
- possibleAnswer1.setText(questions.get(orderList.get(0)).getEnglish());
- possibleAnswer2.setText(questions.get(orderList.get(1)).getEnglish());
- possibleAnswer3.setText(questions.get(orderList.get(2)).getEnglish());
- possibleAnswer4.setText(questions.get(orderList.get(3)).getEnglish());
- possibleAnswer5.setText(questions.get(orderList.get(4)).getEnglish());
- possibleAnswer6.setText(questions.get(orderList.get(5)).getEnglish());
-
- }
-
- }
-
-
- public void checkAnswers() {
-
- ArrayList answer = new ArrayList<>();
-
- answer.add(wordCounterpart);
-
- Question.checkAnswer(wordSet, answer, isEnglish);
-
-
- wordSet.clear();
-
- AssessmentGenerator.goToNextQuestion();
-
- }
-
-
@FXML
private void initialize() {
setup();
@@ -196,6 +107,157 @@ public class SixMeaningsController extends SharedCodeController {
}
+ /**
+ * Event that runs when the user clicks the first answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer1' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer1() {
+ wordCounterPart = possibleAnswer1.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Event that runs when the user clicks the second answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer2' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer2() {
+ // Set 'wordCounterPart' to the value of 'possibleAnswer2'.
+ wordCounterPart = possibleAnswer2.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Event that runs when the user clicks the third answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer3' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer3() {
+ // Set 'wordCounterPart' to the value of 'possibleAnswer3'.
+ wordCounterPart = possibleAnswer3.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Event that runs when the user clicks the fourth answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer4' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer4() {
+ // Set 'wordCounterPart' to the value of 'possibleAnswer4'.
+ wordCounterPart = possibleAnswer4.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Event that runs when the user clicks the fifth answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer5' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer5() {
+ // Set 'wordCounterPart' to the value of 'possibleAnswer5'.
+ wordCounterPart = possibleAnswer5.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Event that runs when the user clicks the sixth answer from the six options. This sets the 'wordCounterPart' to
+ * the value in 'possibleAnswer6' before checking the answer.
+ *
+ * @see Text
+ */
+ @FXML
+ void answer6() {
+ // Set 'wordCounterPart' to the value of 'possibleAnswer6'.
+ wordCounterPart = possibleAnswer6.getText();
+ checkAnswers();
+ }
+
+ /**
+ * Method that sets up the SIxMeanings question onto the screen. It firstly starts by checking the type of question
+ * and displaying the possible answer based off of this.
+ *
+ * @param questions ArrayList of DictionaryEntry's that contains the definition being tested along with other defintions with the first item being the question.
+ * @param orderList ArrayList of integers that 0-5 that is shuffled to randomise the order of possible answers in the question.
+ * @see DictionaryEntry
+ * @see Integer
+ * */
+ public void setWords(ArrayList questions, ArrayList orderList) {
+
+ if (isEnglish) {
+ // If the question is in english, display the possible answers in the welsh.
+ wordSet.add(questions.get(0));
+
+ //WelshWord1 Is the question word and as a result is always right.
+ wordToTranslate.setText(wordSet.get(0).getEnglish());
+ //This stores the correct answer for the english word.
+
+ Collections.shuffle(orderList);
+
+ // Put all of the answers into the FXML Text elements.
+ possibleAnswer1.setText(questions.get(orderList.get(0)).getWelsh());
+ possibleAnswer2.setText(questions.get(orderList.get(1)).getWelsh());
+ possibleAnswer3.setText(questions.get(orderList.get(2)).getWelsh());
+ possibleAnswer4.setText(questions.get(orderList.get(3)).getWelsh());
+ possibleAnswer5.setText(questions.get(orderList.get(4)).getWelsh());
+ possibleAnswer6.setText(questions.get(orderList.get(5)).getWelsh());
+ } else {
+ // Else display the possible answers in the welsh.
+ wordSet.add(questions.get(0));
+
+ //WelshWord1 Is the question word and as a result is always right.
+ wordToTranslate.setText(wordSet.get(0).getWelsh());
+ //This stores the correct answer for the english word.
+
+ Collections.shuffle(orderList);
+
+ // Put all of the answers into the FXML Text elements.
+ possibleAnswer1.setText(questions.get(orderList.get(0)).getEnglish());
+ possibleAnswer2.setText(questions.get(orderList.get(1)).getEnglish());
+ possibleAnswer3.setText(questions.get(orderList.get(2)).getEnglish());
+ possibleAnswer4.setText(questions.get(orderList.get(3)).getEnglish());
+ possibleAnswer5.setText(questions.get(orderList.get(4)).getEnglish());
+ possibleAnswer6.setText(questions.get(orderList.get(5)).getEnglish());
+
+ }
+
+ }
+
+ /**
+ * Method checks the answer the user has submitted against the questions correct answer. This works by passing in the users
+ * 'wordCounterPart' answer with the correct answer into the Question class which does the checking before moving onto the next question.
+ *
+ * @see Question
+ * @see AssessmentGenerator
+ */
+ public void checkAnswers() {
+
+ // Add the users answer into an ArrayList.
+ ArrayList answer = new ArrayList<>();
+ answer.add(wordCounterPart);
+
+ // Call the Question's checkAnswer method to look if the user has selected the correct answer.
+ Question.checkAnswer(wordSet, answer, isEnglish);
+
+ // Clear the wordset and move to the next question.
+ wordSet.clear();
+ AssessmentGenerator.goToNextQuestion();
+
+ }
+
+
+
}
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java
index 71a080f..91f4ceb 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java
@@ -10,6 +10,7 @@ package uk.ac.aber.cs221.group20.javafx;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
+ import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
@@ -123,18 +124,27 @@ public class TranslationController extends SharedCodeController {
@FXML
void translateWord() {
- //Creates ArrayList of answers and ArrayList of user answers to check
- ArrayList usersInput = new ArrayList<>();
- usersInput.add(translationBox.getText());
- ArrayList correctTranslation = new ArrayList<>();
- correctTranslation.add(answer);
+ //Checks to ensure the user has entered a value
+ if(translationBox.getText().equalsIgnoreCase("")){
+ Alert alert = new Alert(Alert.AlertType.ERROR);
+ alert.setTitle("Error");
+ alert.setHeaderText("Please enter an answer");
+ alert.setContentText("Please ensure you enter an answer before clicking submit.");
+ alert.showAndWait();
+ }else {
- //check user answers against correct answers
- Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish());
+ //Creates ArrayList of answers and ArrayList of user answers to check
+ ArrayList usersInput = new ArrayList<>();
+ usersInput.add(translationBox.getText());
+ ArrayList correctTranslation = new ArrayList<>();
+ correctTranslation.add(answer);
- //Open the next question of the assessment.
- AssessmentGenerator.goToNextQuestion();
+ //check user answers against correct answers
+ Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish());
+ //Open the next question of the assessment.
+ AssessmentGenerator.goToNextQuestion();
+ }
}
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java
index 34a1b69..bf6dfd8 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java
@@ -1,5 +1,5 @@
/**
- * @(#) DictionaryEntry.java 0,1 2020/04/07
+ * @(#) DictionaryEntry.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/JsonProcessing.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/JsonProcessing.java
index 058f712..eaf647a 100644
--- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/JsonProcessing.java
+++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/JsonProcessing.java
@@ -1,5 +1,5 @@
/**
- * @(#) JsonProcessing.java 0,1 2020/04/27
+ * @(#) JsonProcessing.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.