Question
I need help creating a GUI (JavaFX application) for my class project, here is the prompt of the project. Here are my codes so far.
I need help creating a GUI (JavaFX application) for my class project, here is the prompt of the project.
Here are my codes so far.
Card class
import javafx.scene.image.Image; public class Card { private String span; private int rank; private int type; private Image img; public Card() { rank = 0; type = 0; //img = getImage(); //Image backImg = new Image("PNG/blue_back.png"); } public void setRank(int r) { rank = r; } public void setSuit(int s) { type = s; } public int getRank() { return rank; } public String getSuit() { switch (type) { case 1: return "spades"; case 2: return "hearts"; case 3: return "diamonds"; case 4: return "clubs"; default: return "Joker"; } } // gets the individual image for each card by sorting cases by type then rank private Image getImage() { Image i = new Image("PNG/blue_back.png"); switch (type) { case 1: switch (rank) { case 1: i = new Image("PNG/AS.png"); case 2: i = new Image("PNG/2S.png"); case 3: i = new Image("PNG/3S.png"); case 4: i = new Image("PNG/4S.png"); case 5: i = new Image("PNG/5S.png"); case 6: i = new Image("PNG/6S.png"); case 7: i = new Image("PNG/7S.png"); case 8: i = new Image("PNG/8S.png"); case 9: i = new Image("PNG/9S.png"); case 10: i = new Image("PNG/10S.png"); case 11: i = new Image("PNG/JS.png"); case 12: i = new Image("PNG/QS.png"); case 13: i = new Image("PNG/KS.png"); default: i = new Image("PNG/AS.png"); } break; case 2: switch (rank) { case 1: i = new Image("PNG/AH.png"); case 2: i = new Image("PNG/2H.png"); case 3: i = new Image("PNG/3H.png"); case 4: i = new Image("PNG/4H.png"); case 5: i = new Image("PNG/5H.png"); case 6: i = new Image("PNG/6H.png"); case 7: i = new Image("PNG/7H.png"); case 8: i = new Image("PNG/8H.png"); case 9: i = new Image("PNG/9H.png"); case 10: i = new Image("PNG/10H.png"); case 11: i = new Image("PNG/JH.png"); case 12: i = new Image("PNG/QH.png"); case 13: i = new Image("PNG/KH.png"); default: i = new Image("PNG/AS.png"); } break; case 3: switch (rank) { case 1: i = new Image("PNG/AD.png"); case 2: i = new Image("PNG/2D.png"); case 3: i = new Image("PNG/3D.png"); case 4: i = new Image("PNG/4D.png"); case 5: i = new Image("PNG/5D.png"); case 6: i = new Image("PNG/6D.png"); case 7: i = new Image("PNG/7D.png"); case 8: i = new Image("PNG/8D.png"); case 9: i = new Image("PNG/9D.png"); case 10: i = new Image("PNG/10D.png"); case 11: i = new Image("PNG/JD.png"); case 12: i = new Image("PNG/QD.png"); case 13: i = new Image("PNG/KD.png"); default: i = new Image("PNG/AS.png"); } break; case 4: switch (rank) { case 1: i = new Image("PNG/AC.png"); case 2: i = new Image("PNG/2C.png"); case 3: i = new Image("PNG/3C.png"); case 4: i = new Image("PNG/4C.png"); case 5: i = new Image("PNG/5C.png"); case 6: i = new Image("PNG/6C.png"); case 7: i = new Image("PNG/7C.png"); case 8: i = new Image("PNG/8C.png"); case 9: i = new Image("PNG/9C.png"); case 10: i = new Image("PNG/10C.png"); case 11: i = new Image("PNG/JC.png"); case 12: i = new Image("PNG/QC.png"); case 13: i = new Image("PNG/KC.png"); default: i = new Image("PNG/AS.png"); } break; } return i; } }
Deck class
import java.util.Random; public class Deck { private Card deck[]; public Deck() { int count = 0; Card[] deck = new Card[52]; do { Card card = new Card(); deck[count] = card; //if (rank 0; i--) { int index = gen.nextInt(i + 1); Card x = deck[index]; deck[index] = deck[i]; deck[i] = x; } } public Card testRank(int i) { return deck[i]; } public Card testSuit(int i) { return deck[i]; } }
Test Class /** * Write a description of class Test here. * * @author (your name) * @version (a version number or a date) */ public class Test { public static void main(String[] args) { Deck tdeck = new Deck(); System.out.println("Rank: " + tdeck.testRank(25).getRank()); System.out.println("Suit: " + tdeck.testSuit(25).getSuit()); } }
CS114 Group Project The purpose of this project is to have two persons collaborating together to c Simulating a card deck Trump Gam Company asked the bidders to The following are the specifications: ing Company wants small software companies to bid for it launch of Online gaming EasySoft in Plainfield, NJ wants to participate in it. As part of its evaluation, Trump Gaming develop on-line 5 card poker game 1. Design a Card class where Card object represents an individual playing card. Each card must have a suit - clubs, diamonds, heart, spades and a value 2 through 10, jack, queen, king and ace. Each card has a state face up or down. Each has an associated image and a common face down image and a rank 0 through 51 You will need a Deck class. The class will need an array to store 52 cards. You will need methods to deal a card, shuffle the deck, and sort the deck You will need a JavaFX Application that will respond to button clicks Shuffle, Sort, Show/Hide Deck. You can display the deck either with string representation like 2. 3. 2c 3c 4c 2d 3d 4d 2h 3h 4h 2s 3s A Or display the images in that order You may want to create a 5 card poker game and tellif they won a pair, triples or other jackpots. 4. To complete the project: You will need to research and get images for a deck of cards. Plan out the java application user interface You will need to learn about sorting, and show the original just opened deck to customers. . . You will plan to how you are going to shuffle the order of cards .Create the 5 card poker game, display the cards and specify the winnings CS114 Group Project The purpose of this project is to have two persons collaborating together to c Simulating a card deck Trump Gam Company asked the bidders to The following are the specifications: ing Company wants small software companies to bid for it launch of Online gaming EasySoft in Plainfield, NJ wants to participate in it. As part of its evaluation, Trump Gaming develop on-line 5 card poker game 1. Design a Card class where Card object represents an individual playing card. Each card must have a suit - clubs, diamonds, heart, spades and a value 2 through 10, jack, queen, king and ace. Each card has a state face up or down. Each has an associated image and a common face down image and a rank 0 through 51 You will need a Deck class. The class will need an array to store 52 cards. You will need methods to deal a card, shuffle the deck, and sort the deck You will need a JavaFX Application that will respond to button clicks Shuffle, Sort, Show/Hide Deck. You can display the deck either with string representation like 2. 3. 2c 3c 4c 2d 3d 4d 2h 3h 4h 2s 3s A Or display the images in that order You may want to create a 5 card poker game and tellif they won a pair, triples or other jackpots. 4. To complete the project: You will need to research and get images for a deck of cards. Plan out the java application user interface You will need to learn about sorting, and show the original just opened deck to customers. . . You will plan to how you are going to shuffle the order of cards .Create the 5 card poker game, display the cards and specify the winningsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started