The two arrays are not empty and are the same length. Return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer.scoreUp(["a", "a", "b", "b"], ["a", "c", "b", "c"]) → 6...
AP-1, Part III CodingBat: Java. Recursion-1, Part II → 9 thoughts on “CodingBat: Java. Recursion-1, Part I” KellyJune 3, 2015 at 2:51 pm Also working count8: public int count8(int n) { if (n == 0) { return 0; } if ((n/10%10 ==8) && (n % 10 == 8)) {...
1 2 3 4 5 6 7 public int scoreUp(String[] key, String[] answers) { int sum = 0; for (int i = 0; i < answers.length; i++) if (answers[i] == key[i]) sum += 4; else if (!answers[i].equals("?")) sum -= 1; return sum; } ...