java : two dimentional multiple choice check
public class Shosmo{
public static void score(char [ ] [ ] in){
char [] key ={'A','B','C','D','E','F'};
int count =0;
for (int i=0;i<in.length;i++){
for (int j=0;j<in[i].length;j++)
if (in[i][j]==key[j])count++;
System.out.println("for student "+i+" = "+count);
count=0;
}
}
public static void main (String [ ] إمتحان){
char [][] ans={{'A','C','A','C','B','D'},
{'E','A','F','A','B','F'},
{'F','F','F','F','C','A'},
{'A','B','A','F','B','A'},
{'E','F','E','A','B','C'},
{'A','A','A','A','A','A'}
};
score(ans);
}
}
0 التعليقات: