Question: How to I change this code to print the highest value(s) in the array? The wanted output (you just need to make it print the
How to I change this code to print the highest value(s) in the array? The wanted output (you just need to make it print the winner, ignore what comes before) is included below:

--------------------------------------------------------------------------------------------
public static void playGame(int players, int cards) {
if (players * cards > 52) {
System.out.println("Not enough cards for that many players.");
return;
}
boolean[] deck = new boolean[52];
int[] playerScore = new int[players];
for (int i = 0; i
System.out.println("Player " + (i + 1));
int[] hand = Cards.dealHandFromDeck(cards, deck);
Cards.printHand(hand);
System.out.println("Score = " + Cards.pointValue(hand));
System.out.println();
playerScore[i] = Cards.pointValue(hand);
}
//go through playerScore array twice, first to find the highest score, then print which player(s) have that score
Example:s Player 1 4/S J/D Score 1 Player 1 K/H 9/D Score 1 Player 1 9/C J/H Score 1 Player 2 2/C T/C Score -2 Player 2 2/S A/C Score 3 Player 2 5/H J/C Score 1 Player 3 J/S 9/H Score 1 Player 3 K/S Q/D Score 3 Player 3 J/S 8/H Score 1 Player 2 is a winner. Player 2 is a winner. Player 3 is a winner Player 1 is a winner. Player 2 is a winner Player 3 is a winner
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
