This repository has been archived on 2022-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
uni-group-project/dev/20200427/maj83/Question.java
2020-04-27 16:42:51 +01:00

48 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package uk.ac.aber.cs22120.group20.selfassessment;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.util.ArrayList;
/**
* Abstract class contains the basic information that all the shared information between the
* types of test questions including the questions correct answers and possible answers. All question
* classes will extend this class.
* @Author
* @Version
* @See
*/
public class Question {
public int correctAnswer = 0;
public int wrongAnswer =0;
/**
* Constructor for
* WordEnterQuestion that takes a WelshDictionary object that is being tested on as the parameter.
* @param correctAnswer
*/
public void wordEnterQuestion(DictionaryEntry correctAnswer){
}
public void checkAnswer(ArrayList<DictionaryEntry> listOfCorrectQuestions, ArrayList<String>listOfAnswers, boolean isEnglish){
if(isEnglish){
for(int i=0; i<listOfCorrectQuestions.size();i++){
if(listOfCorrectQuestions.get(i).getEnglish().equals(listOfAnswers.get(i))){
correctAnswer++;
}else wrongAnswer++;
}
}else{
for(int i=0; i<listOfCorrectQuestions.size();i++){
if(listOfCorrectQuestions.get(i).getWelsh().equals(listOfAnswers.get(i))){
correctAnswer++;
}else wrongAnswer++;
}
}
}
}