Question: As an example, if the values were 1 , 2 , and 4 , and the guess was 7 , the score would be 0
As an example, if the values were and and the guess was the score would be a perfect score! However, if the values were and and the guess was the score would be And if the the values were and and the guess was the score would be
Write a snippet of code not a method that computes the score of a game. The values on the cards will be stored in an existing int array named values, and the guess in an int variable named guess. You should declare an int variable score and set its value to the score of that game. Do not modify values or guess.
You will need to compute the sum of the values in the array! You may also find the Math.abs method helpful when completing this problem, but it is not required.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
