Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started