Im trying to make a quiz program in java but the answersheet does not work and does not match the user inputted answer. I cantt figure out what's wrong really. Thanks.
My Code :
String [][] x = new String [10][1];
x [0][0] = "1+2";
x [1][0] = "1+3";
x [2][0] = "1+4";
x [3][0] = "1+5";
x [4][0] = "1+6";
x [5][0] = "1+7";
x [6][0] = "1+8";
x [7][0] = "1+9";
x [8][0] = "1+10";
x [9][0] = "1+11";
int count = 0;
String[] answersheet= {"b","d","a","a","c","a","a","d","b","b"};
String user = "";
for (int y = 0 ; y < 1 ; y++) {
for (int z = 0 ; z < 10 ; z++) {
System.out.print(" "+x[z][y]);
user = console.next();
}
for (int y1 = 0; y1 < 10; y1++){
count= count + 1;
if (user.equals(answersheet[y1])){
System.out.println("Q" +count+ " Is correct ");
}else
System.out.println("Q "+count+ "is Wrong ");
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire