Create array of 52 card objects assigning a different value


Problem

I. You modified a previously created Card class so that each Card would hold the name of a suit (Spades, Hearts, Diamonds, or Clubs) as well as a value (Ace, King, Queen, Jack, or a number value). Now, create array of 52 Card objects, assigning a different value to each Card, and display each Card. Save the application as FullDeck.java.

II. You created a War2 card game that randomly selects two Card objects (one for the player and one for the computer) and declares a winner or a tie based on the card values. Now create game that plays 26 rounds of War, dealing a full deck with no repeated cards. Some hints:

1) Start by creating an array of all 52 playing cards, as in Part a of this exercise.

2) Select a random number for the deck position of the player's first card, and assign the card at that array position to the player.

3) Move every higher-positioned card in the deck "down" one to fill in the gap. In other words, if the player's first random number is 49, select the card at position 49, move the card that was in position 50 to position 49, and move the card that was in position 51 to position 50. Only 51 cards remain in the deck after the player's first card is dealt, so the available-card array is smaller by one.

4) In the same way, randomly select a card for the computer and "remove" the card from the deck.

5) Display the values of the player's and computer's cards, compare their val¬ues, and determine the winner.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create array of 52 card objects assigning a different value
Reference No:- TGS03225415

Expected delivery within 24 Hours