|
|
|
|
@ -32,17 +32,19 @@ public class MultipleChoiceGenerator {
|
|
|
|
|
private void SetChoiceList(){
|
|
|
|
|
for(int i = 0 ; i < this.AnswerList.length ; i++){
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
String[] choiceNo = {"A.","B.","C.","D."};
|
|
|
|
|
String[] choices = new String[4];
|
|
|
|
|
double correctChoice = Double.parseDouble(this.AnswerList[i]);
|
|
|
|
|
int position = random.nextInt(4);
|
|
|
|
|
choices[position] = String.format("%.2f", correctChoice);
|
|
|
|
|
choices[position] = choiceNo[position] + String.format("%.2f", correctChoice);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int j = 0 ; j < 4 ; j++){
|
|
|
|
|
if(j != position){
|
|
|
|
|
double choice = correctChoice;
|
|
|
|
|
double offset = random.nextInt(41) - 20;
|
|
|
|
|
choice += offset;
|
|
|
|
|
choices[j] = String.format("%.2f", choice);
|
|
|
|
|
choices[j] =choiceNo[j] + String.format("%.2f", choice);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|