Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. 29) A
  2. 30) A
  3. 31) B
  4. 32) D
  5. 33) B
  6.  
  7. //6
  8.  
  9. public class ArrayTwoD {
  10.  
  11. public static void main(String[] args) {
  12. String[][] list = { {"a", "b", "a", "c", "c", "d", "e", "e", "a", "d"},
  13. {"d", "b", "a", "b", "c", "a", "e", "e", "a", "d"},
  14. {"e", "d", "d", "a", "c", "b", "e", "e", "a", "d"},
  15. {"c", "b", "a", "e", "d", "c", "e", "e", "a", "d"},
  16. {"a", "b", "d", "c", "c", "d", "e", "e", "a", "d"},
  17. {"b", "b", "e", "c", "c", "d", "e", "e", "a", "d"},
  18. {"b", "b", "a", "c", "c", "d", "e", "e", "a", "d"},
  19. {"e", "b", "e", "c", "c", "d", "e", "e", "a", "d"} };
  20.  
  21. int[] score = new int[list.length];
  22. String[] key = {"d", "b", "d", "c", "c", "d", "a", "e", "a", "d"};
  23. for (int i=0;i<list.length;i++){
  24. for (int j=0;j<list[i].length;j++){
  25. if (list[i][j] == key[j])score[i]++;
  26. }
  27.  
  28. }
  29. for (int i=0;i<score.length;i++){
  30. System.out.print(i + ": " + score[i] + " | ");
  31. }
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement