This is the java code i have written to deal 5 cards to each of 6 poker players
ID: 3528464 • Letter: T
Question
This is the java code i have written to deal 5 cards to each of 6 poker players and display their hands ( it is wrong). Player one should get the 1,7,13,19,25 card of the shuffled deck. Player two should get the 2,8,14,20,26 card of the shuffled deck. Player three should get the 3,9,15,21,27 card of the shuffled deck.Player four should get the 4,10,16,22,28 card of the shuffled deck. Player five should get the 5,11,17,23,29 card of the shuffled deck. Player six should get the 6,12,18,24,30 card of the shuffled deck. import java.util.Scanner; public class Dealer { public static void main(String[] args){ Scanner input = new Scanner(System.in); int[] deck = new int [52]; String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"}; String[] ranks = {"Ace", "2", "3","4","5","6","7","8", "9","10", "Jack", "Queen", "King"}; for (int i=0; i<5; i++){ String suit = suits[deck[i]/13]; String rank = ranks[deck[i]]; System.out.println("Player One's Hand Is: "); System.out.println("card number " + deck[i] + " a " + rank + " of " + suit );} }}Explanation / Answer
place holder while I finish debugging. will post link in comment :3
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.