Write a Java program that picks four cards randomly from a deck of 52 cards. You will need to shuffle the deck to get random cards. A deck of cards consists of four suits Diamonds, Hearts, Clubs, Spades. Each suit has the following cards; Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10 Jack, Queen, King. The deck of cards can be represented using an array named deck, filled with initial values 0 to 51.
Console Output
Card number 35: 10 of Diamonds
Card number 14: 2 of Hearts
Card number 45: 7 of Clubs
Card number 41: 3 of Clubs
Answers
Write a Java program that picks four cards randomly from a deck of 52 cards. You will need to shuffle the deck to get random cards. A deck of cards consists of four suits Diamonds, Hearts, Clubs, Spades. Each suit has the following cards; Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10 Jack, Queen, King. The deck of cards can be represented using an array named deck, filled with initial values 0 to 51.
Console Output
Card number 35: 10 of Diamonds
Card number 14: 2 of Hearts
Card number 45: 7 of Clubs
Card number 41: 3 of Clubs
Answer:
Write a Java program that picks four cards randomly from a deck of 52 cards. You will need to shuffle the deck to get random cards. A deck of cards consists of four suits Diamonds, Hearts, Clubs, Spades. Each suit has the following cards; Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10 Jack, Queen, King. The deck of cards can be represented using an array named deck, filled with initial values 0 to 51.
Console Output
Card number 35: 10 of Diamonds
Card number 14: 2 of Hearts
Card number 45: 7 of Clubs
Card number 41: 3 of Clubs