id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

Java > AP-1 > scoreUp
prev  |  next  |  chance

The "key" array is an array containing the correct answers to an exam, like {"a", "a", "b", "b"}. the "answers" array contains a student's answers, with "?" representing a question left blank. 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
scoreUp({"a", "a", "b", "b"}, {"a", "a", "b", "c"}) → 11
scoreUp({"a", "a", "b", "b"}, {"a", "a", "b", "b"}) → 16

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  AP-1

Forget It! -- delete my code for this problem 239.0

Copyright Nick Parlante 2006-10 - privacy