Question
A project focus on the data structure- collection. Create a solitaire card game called Aces Up. Need at 4 java objects to let this game
A project focus on the data structure- collection. Create a solitaire card game called Aces Up. Need at 4 java objects to let this game working.
The following is a screenshot of the game. The GUI does not have to look exactly the same. gui looks like this following hand drawing, doesn't need to be fancy. very simple is fine.
These 52 Cards and a facedown card are already provided.
These 3 fold are provided.
ImageDemo.java(This is Demo just get one card, but the final version needs to get 52 cards)
import java.awt.*; import java.awt.event.*; import javax.swing.*;
/** This class demonstrates how to use an ImageIcon and a JLabel to display an image. */
public class MyCardImage extends JFrame { private JPanel imagePanel; // To hold the label private JPanel buttonPanel; // To hold a button private JLabel imageLabel; // To show an image private JButton button; // To get an image
/** Constructor */
public MyCardImage() { // Set the title. setTitle("My Card");
// Specify an action for the close button. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create a BorderLayout manager. setLayout(new BorderLayout());
// Build the panels. buildImagePanel(); buildButtonPanel();
// Add the panels to the content pane. add(imagePanel, BorderLayout.CENTER); add(buttonPanel, BorderLayout.SOUTH);
// Pack and display the window. pack(); setVisible(true); }
/** The buildImagePanel method adds a label to a panel. */
private void buildImagePanel() { // Create a panel. imagePanel = new JPanel();
// Create a label. imageLabel = new JLabel("Click the button to " + "see an image of my cat."); // Add the label to the panel. imagePanel.add(imageLabel); }
/** The buildButtonPanel method adds a button to a panel. */
private void buildButtonPanel() { ImageIcon smileyImage;
// Create a panel. buttonPanel = new JPanel();
// Create a button. button = new JButton("Get Image"); // Register an action listener with the button. button.addActionListener(new ButtonListener());
// Add the button to the panel. buttonPanel.add(button); }
/** Private inner class that handles the event when the user clicks the button. */
private class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { // Read the image file into an ImageIcon object. ImageIcon cardImage = new ImageIcon("3_clubs.jpg");
// Display the image in the label. imageLabel.setIcon(cardImage);
// Remove the text from the label. imageLabel.setText(null);
// Pack the frame again to accomodate the // new size of the label. pack(); } } /** The main method creates an instance of the MyCatImage class which causes it to display its window. */ public static void main(String[] args) { new MyCardImage(); } }
//end of ImageDemo.java
A GamePannel version is given as following:
//******************************************************************** // GridPanel.java Java Foundations // // Represents the panel in the LayoutDemo program that demonstrates // the grid layout manager. //********************************************************************
import java.awt.*; import javax.swing.*;
public class GridPanel extends JPanel { //----------------------------------------------------------------- // Sets up this panel with some buttons to show how grid // layout affects their position, shape, and size. //----------------------------------------------------------------- public GridPanel() { setLayout(new GridLayout(2, 3));
setBackground(Color.green);
JButton b1 = new JButton("BUTTON 1"); JButton b2 = new JButton("BUTTON 2"); JButton b3 = new JButton("BUTTON 3"); JButton b4 = new JButton("BUTTON 4"); JButton b5 = new JButton("BUTTON 5");
add(b1); add(b2); add(b3); add(b4); add(b5); } }
//end of the GamePannel.java
* need to see an fianl output please.
Create a version of the solitaire A website with a version of the game and the rules for playing the game are included in the document (Project 1 Rules https://www.wikihow.com/Play-Aces-Up Online version of the game http://webofsol Also included in the Project 1 session on webstudy are the following: card game called Aces Up. Spring 2018 Game Rules). Solitaire-Aces-Up/ Cards folder containing ipg files for a deck of playing cards * ageDemo folder -the example places an image on a label, the process is similar for a button LayoutDemo folder-demonstrates the use of layout managers .A test case template . This document The most obvious abstraction is that of a Playing Card. Create a class named PlayingCard, which can be used to represent a card from a deck of cards. The class should be able to storeja card's suit and face value. It shouldalso storelan image of the specific card. I have given to you a zip file containing the images for a deck of playing cards A PlayingCard's suit ban be one of the following: Hearts, Diamonds, Spades, or Clubs. A PlayingCard's valuejcan be: Ace, Jack, Queen, King, or a value in the range of two through ten. Use an appropriate Linked data structure that we have discussed and modified in class. The piles of cards will be represented as a collection of Playing Cards implemented asja linked collection.)It should implement an appropriate ADT. Do not use the classes defined in the Java Collections API ed LinearNode to serve as the node class for your collection. Create a class call Don't forget about private inner classes. I have given you some Create other classes as necessary. flexibility in your implementation as indicated in the below suggestions. Remember that the o be organized but does not have to look exactly the same as the example. gui needs Demonstrate these classes in a class called Aces. Some suggestions: .Review the java API documentation as necessary You may want to remove the jokers and the backface cards from the er Create a version of the solitaire A website with a version of the game and the rules for playing the game are included in the document (Project 1 Rules https://www.wikihow.com/Play-Aces-Up Online version of the game http://webofsol Also included in the Project 1 session on webstudy are the following: card game called Aces Up. Spring 2018 Game Rules). Solitaire-Aces-Up/ Cards folder containing ipg files for a deck of playing cards * ageDemo folder -the example places an image on a label, the process is similar for a button LayoutDemo folder-demonstrates the use of layout managers .A test case template . This document The most obvious abstraction is that of a Playing Card. Create a class named PlayingCard, which can be used to represent a card from a deck of cards. The class should be able to storeja card's suit and face value. It shouldalso storelan image of the specific card. I have given to you a zip file containing the images for a deck of playing cards A PlayingCard's suit ban be one of the following: Hearts, Diamonds, Spades, or Clubs. A PlayingCard's valuejcan be: Ace, Jack, Queen, King, or a value in the range of two through ten. Use an appropriate Linked data structure that we have discussed and modified in class. The piles of cards will be represented as a collection of Playing Cards implemented asja linked collection.)It should implement an appropriate ADT. Do not use the classes defined in the Java Collections API ed LinearNode to serve as the node class for your collection. Create a class call Don't forget about private inner classes. I have given you some Create other classes as necessary. flexibility in your implementation as indicated in the below suggestions. Remember that the o be organized but does not have to look exactly the same as the example. gui needs Demonstrate these classes in a class called Aces. Some suggestions: .Review the java API documentation as necessary You may want to remove the jokers and the backface cards from the erStep 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