Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Display three cards) Write a program(JavaFX application) that displays three ca

ID: 643543 • Letter: #

Question

(Display three cards) Write a program(JavaFX application) that displays three cards randomly selected from a deck of 52.

Suppose card image files are named 1.png, 2.png, ..., 52.png and stored in the image/card directory in the package. All three cards are distinct and selected randomly. This application file should be placed in a package: javafxpkg.3randomcards.

Hint: You can select random cards by storing the nubmers 1-52 to an array list, perform a random shuffle and use the first three numbers in the array list as the file names for the image. Use this: java.util.Collections.shuffle(alist).

Explanation / Answer

ackage javacards; 02 03 import java.util.Random; 04 05 public class Deck { 06     private Card[] cards; 07     int i; 08 09     Deck() 10     { 11         i=51; 12         cards = new Card[52]; 13         int x=0; 14         for (int a=0; a