1.1-Introductie-Programmeren

Generating a deck of cards - with images!

Difficulty: Filled Filled Outlined

Create a createDeckOfCards method that returns a list of all 52 cards in a regular deck of cards (without jokers). Add the image location (file name) as an additional attribute to your “Card” class. We have provided the images for all cards in the “resources/cardimages” folder and the cards have been conveniently named <value><suit>.png.

For example, the 10 of Diamonds can be found in the image “resources/cardimages/10D.png”. (You have to figure out how to create the file name but think about String concatenation!)

Once you have updated your Card class with images, create a program that shows 5 cards at random. Make sure you don’t get the same card twice!

(Images: American Contract Bridge League)

Example

Example