mikeguylol

AP Computer Science Question 1

Apr 26th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public int keyScore(String[] key, String[] answers)
  2. {
  3.  int score = 0;
  4.  for(int i = 0; i < key.length; i++)
  5.  {
  6.   if(key[i].equals(answers[i]))
  7.   {
  8.    score += 3;
  9.   } else if(answers[i].equals("_")) {
  10.    score += 0;
  11.   } else {
  12.    score -= 1;
  13.   }
  14.  }
  15. return score;
  16. }
Add Comment
Please, Sign In to add comment