Question: Hello, I am having a hard time getting this java program to compile correctly. It's a card game called spades. Below are the parameters for

Hello, I am having a hard time getting this java program to compile correctly. It's a card game called spades. Below are the parameters for each class. Your help is greatly appreciated. Thanks in advance!

[Edited]

Below is the Java Code that I have so far:

[Spades.java]

package spades;

import javax.swing.JOptionPane; import core.Game;

public class Spades {

public static void main(String[] args) { System.out.println("Welcome to Spades!"); //This is the print command JOptionPane.showMessageDialog(null, "Let's Play Spades!"); //This is the JOptionPane Dialog command //Instantiate an instance of class Game calling the no-argument constructor Game game = new Game(); } }

------------------------------------------------------------------------------------------------------------------------------

[Constants.java]

package constants;

public class Constants { public static final int NUM_AI_PLAYERS = 3; public static final int NUM_CARD_DECK = 52; public static final int NUM_CARD_DEALT = 13; public static final int NUM_GAME_ROUND = 13; public static final int MINIMUM_BID_VALUE = 1; public static final int WINNING_SCORE = 200; }

public enum Color{ RED, Black }

public enum Suit{ CLUBS, HEARTS, SPADES, DIAMONDS }

public enum Face{ TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }

--------------------------------------------------------------------------------------------------------------------------------------

[AiPlayer.java]

package core;

public class AiPlayer extends Player { //Here we group AiPlayer subclass to Player Superclass @Override public Card playCard(); @Override public int placeBid(); }

---------------------------------------------------------------------------------------------------------------------------------------

[Card.java]

package core;

import constants.Constants.Color; import constants.Constants.Face; import constants.Constants.Suit;

public class Card { private Face face; private Suit suit; private Color color; }

public Face getFace(){ return face; }

--------------------------------------------------------------------------------------------------------------------------------------

[Deck.java]

package core;

public class Deck { private Set deck; public Set getDeck(){ return deck; } public void setDeck(Set deck){ this.deck = deck; } }

---------------------------------------------------------------------------------------------------------------------------------------

[Game.java]

package core;

import constants.Constants; import constants.Constants.Suit; import java.util.ArrayList; import java.util.Scanner;

public class Game { private Player dealer; private Player wonTrick; private int round; private ArrayList teams; private Deck deck; private Scanner scan; public Game(){ createTeams(); outputTeams(); } private void createTeams(){ teams = new ArrayList(); Team teamOne = new Team(); teamOne.setTeamName("Team One"); teams.add(teamOne); Team teamTwo = new Team(); teamTwo.setTeamName("Team Two"); teams.add(teamTwo); scan = new Scanner(System.in); System.out.println("Enter human player name"); String name = scan.next(); HumanPlayer hp = new HumanPlayer(); hp.setName(name); System.out.println("Human Player added to Team One"); teamOne.getTeam().add(hp); for (int p=1; p

---------------------------------------------------------------------------------------------------------------------------------------

[HumanPlayer.java]

package core;

public class HumanPlayer extends Player{ //Here we group HumanPlayer subclass to Player Superclass @Override public Card playCard(); @Override public int placeBid(); }

--------------------------------------------------------------------------------------------------------------------------------------

[IPlayer.java]

package core;

public interface IPlayer { public static void player(String[] args){

public Card playCard(); public int placeBid(); } }

----------------------------------------------------------------------------------------------------------------------------------------

[Player.java]

package core;

public abstract class Player implements IPlayer { //Here we implement IPlayer to abstract class of Player private String name; private int bid; private int score; private int tricks; public abstract Card playCard(); public abstract int placeBid(); public String getName(){ return name; } }

-----------------------------------------------------------------------------------------------------------------------------------------

[Team.java]

package core;

import java.util.ArrayList;

public class Team { private ArrayList team; private int teamBid; private int teamScore; private int teamTricks; private int teamBags; private String teamName; public Team{ team = new ArrayList(); } public int getTeamBid(){ } }

----------------------------------------------------------------------------- End of Code -------------------------------------------------------------------

Hello, I am having a hard time getting this java program to

compile correctly. It's a card game called spades. Below are the parameters

for each class. Your help is greatly appreciated. Thanks in advance! [Edited]

Below is the Java Code that I have so far: [Spades.java] package

Tasks Activity Spades project Spades class Update main) method to do the following 1. Instantiate an instance of class Game calling the no-argument constructor constants Constants class | Add the following A constant for the number of AI players set to the value of 3 A constant for the number of cards in a standard deck set to the value of 52 A constant for the number of cards each player is dealt set to the value of 13 A constant for the number of rounds in a game set to the value of 13 A constant for the minimum bid value of a player set to the value of 1 A constant for the winning score set to the value of 200 1. 2. 3. 4. 5. 6. 7. An enumeration for the color of cards so it includes: RED and 8. An enumeration for the suit of cards so it includes: CLUBS, 9. An enumeration for the face value of cards so it includes: TWO, BLACK DIAMONDS, HEARTS, SPADES THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, OUEEN, KING, ACE core package AiPlayer class Implement methods inherited from class Player 1. public Card playCardO; 2. public int placeBid(); Card class . Add member variables (Hint: you will have to explicitly import each enumeration, example: import constants.Constants.Color;) a. Data type enumeration Face to represent the face value of the card b. Data type enumeration Suit to represent the suit of the card c. Data type enumeration Color to represent the color of the card 2. Generate getters/setters for member variables 1. Add member variable Deck class a. Data type Set to represent the deck of cards 2. 1. Generate getter/setter for member variables Add member variables Game class a. Data type enumeration Suit to represent the trump suite of spades Tasks Activity Spades project Spades class Update main) method to do the following 1. Instantiate an instance of class Game calling the no-argument constructor constants Constants class | Add the following A constant for the number of AI players set to the value of 3 A constant for the number of cards in a standard deck set to the value of 52 A constant for the number of cards each player is dealt set to the value of 13 A constant for the number of rounds in a game set to the value of 13 A constant for the minimum bid value of a player set to the value of 1 A constant for the winning score set to the value of 200 1. 2. 3. 4. 5. 6. 7. An enumeration for the color of cards so it includes: RED and 8. An enumeration for the suit of cards so it includes: CLUBS, 9. An enumeration for the face value of cards so it includes: TWO, BLACK DIAMONDS, HEARTS, SPADES THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, OUEEN, KING, ACE core package AiPlayer class Implement methods inherited from class Player 1. public Card playCardO; 2. public int placeBid(); Card class . Add member variables (Hint: you will have to explicitly import each enumeration, example: import constants.Constants.Color;) a. Data type enumeration Face to represent the face value of the card b. Data type enumeration Suit to represent the suit of the card c. Data type enumeration Color to represent the color of the card 2. Generate getters/setters for member variables 1. Add member variable Deck class a. Data type Set to represent the deck of cards 2. 1. Generate getter/setter for member variables Add member variables Game class a. Data type enumeration Suit to represent the trump suite of spades

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!