Question: write a Write a method ( or function ) named scoreGame that returns the score of a game. scoreGame receives two parameters: an IntArray containing
write a
Write a method or function named scoreGame that returns the score of a game. scoreGame receives two parameters: an IntArray containing the values on the cards, and an Int that stores the player's guess. Your method should return the score of the game as an Int.
You will need
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.
If you have
If you have solved this problem previously without writing a method, you may reuse your old code! However, you may try to eliminate the score variable that we used previously.
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
