advanced java 1

Create classes to support a playing cards game according to the attached and making use of the Collections framework.

Playing Cards Deck

1. Write a class named Card which can represent a card from a card deck. It should contain

two pieces of information:

o Card Suits: Hearts, Diamonds, Spades, and Clubs.

o Card Face value: Ace, Jack, Queen, King, or numbers 2 through 10

2. Write a class named Deck to create a deck of cards.

o Constructor should create a deck of 52 Card objects to create a full deck of cards

 Bonus: replace 2 deuces with the big and little jokers

o Provide a method to shuffle the deck

 Use the Collections static shuffle method

o Provide a method to deal a card from the top of the deck

3. Write a class named CardPlayer that keeps a list of Card objects that have been dealt to

the player:

o Provide a getCard method to accept a reference to a Card object

o Provide a showCards method to display the hand of cards

4. Create an executable class that creates a shuffled deck, deals 5 cards to two players, then

displays the players hands.

Create the program described in the attached and submit the eclipse solution folder.

Generics Exercise

Create a class named RandomPermutation that contains a static and generic method named randomize which:

1. Takes a generic list as a parameter and returns a like list.

a. The list returned should be a copy of the original list with the elements loaded in a random order.

2. Call the method from main passing a list of strings, then a list of integers.

3. Print the original list, then the randomized list.

e.g.:

Here is the original string list:

[Ann, Billy, Carol, Douglas, Greg, Harriet, Jennifer, Patrick, Zoe]

Here is the randomized version:

[Carol, Zoe, Ann, Harriet, Jennifer, Patrick, Douglas, Billy, Greg]

Here is the original list of numbers:

[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

Here is the randomized version:

[40, 100, 70, 80, 30, 10, 60, 90, 20, 50]

Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Open chat