COP3330 Object Oriented Programming Euchre Project Part 6 Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

5/5 - (2 votes)

Assignment Scope       

 

For this assignment each player will either accept or reject the trump suit.  If the player accepts the trump suit they say “Pick it up!”  If the player rejects the trump suit they say “Pass.”  The human player will be able to respond as desired.  For the AI players it will depend upon how many cards in their hand match the trump suit.  For our purposes we will implement the version of Euchre called “Stick the Dealer.”  What that means is, if every player passes on the trump suit the dealer has to accept it!

 

To accomplish this:

  1. Reference the tasks below for the specifics of the source code requirements.
  2. Compress a project and submit to Webcourses
  3. Decompress compressed project and verify it is a Netbeans project

 

References

  1. docx
  2. Setting up a project in Netbeans.docx
  3. Netbeans right click menu help.docx

 

Deliverables

To complete this assignment, you must submit your compressed Netbeans project to Webcourses.

 

Please keep in mind that the tasks are guidance to accomplish the goals of the assignment.  At times students will be required to do additional research (e.g. Google That S**T (GTS)!) to find implementation options.  In the industry, software engineers are expected to be very self-sufficient to find the best solution for the task at hand.

 

I have provided multiple code examples on Webcourses that shows how to implement numerous of the tasks below, please reference those code examples prior to asking me for help!   

 

Tasks and Rubric

Activity
euchre package    
constants package    
Constants.java 1.      Update class to add the following constant

a.       MAX_PASSES = 3

b.      MIN_TRUMP = 3

 
core package    
AiPlayer.java 1.      Update class to add the following member variables

a.       Game game

2.      Add a setter for member variable of class Game

3.      Update method makeTrump() so it does the following

a.       Checks if the max number of passes has been reached (i.e. 3) by calling method getTrumpCheck from class Game

i.      If true, display a message dialog to the player (i.e. the dealer) that they have to accept trump

ii.      Call method setAcceptTrump passing as an argument the value true

b.      Else

i.      Create a local variable to count how many cards the player has of the trump suit

ii.      Loop through the player’s hand, for each card in their hand

1.      Check if the current card’s suit matches the trump card’s suit

2.      HINT: reference member variable of class Game calling method getTrump to retrieve the trump card

iii.      Check if the trump counter is greater than or equal the value of 3 (e.g. this is a good indicator the team will win the hand)

1.      If true, call method setAcceptTrump() passing as an argument the value true

2.      Display a message dialog stating that the current player has said “Pick it Up!”

iv.      Else

1.      Call method setAcceptTrump() passing as an argument the value false

2.      Display a message dialog stating that the current player has said “Pass!”

 
Game.java 1.      Update class to add the following member variables

a.       int trumpCheck

b.      Team trumpTeam

 
  2.      Add a getter for member variable trumpCheck

3.      Update customer constructor Game() to do the following

a.       Comment out the call the method play()

4.      Update method createTeams() to do the following

a.       On the instance of class HumanPlayer, call method setGame() passing as an argument a reference to this class Game

b.      On the instance of class AiPlayer, call method setGame() passing as an argument a reference to this class Game

5.       Update method play() to do the following

a.       Comment out any current code

b.      Add a call to method trumpCheck

6.      Add method trumpCheck to do the following

a.       Return type void

b.      Empty parameter list

c.       Initialize member variable trumpCheck to the value of 0

d.      Create a local variable of data type int to represent the current player, initialized to the member variable leadIdx

e.       Loop while the value of member variable trumpCheck is less than the number of players

i.      Instantiate an instance of class Player set equal to member variable getting the player at the position represented by local variable created in step d. (i.e. starting with the lead player)

ii.      On the Player object from above, call method makeTrump()

iii.      Check if the Player object accepted the trump by calling method getAcceptTrump()

1.      If true, loop through the member variable of data type ArrayList that stores the teams in the game

2.      Check if the current team contains the current player (HINT: use method contains() that is part of the class ArrayList)

a.       If true, set the member variable trumpTeam equal to the current team

b.      Display a dialog message to state which team has accepted the trump suit

3.      Break out of the while loop if trump has been accepted

iv.      Else

1.      Increment the member variable trumpCheck by one

v.      Increment the local variable representing the current player by one; be sure to check if the counter is equal to 3, then reset it to 0 (e.g. remember, the table member variable has only 4 elements so the maximum index is 3)

 
HumanPlayer.java 1.      Update class to add the following member variables

a.       Game game

2.      Add a setter for member variable of class Game

3.      Update method makeTrump() so it does the following

a.       Checks if the max number of passes has been reached (i.e. 3) by calling method getTrumpCheck from class Game

i.      If true, display a message dialog to the player (i.e. the dealer) that they have to accept trump

ii.      Call method setAcceptTrump passing as an argument the value true

b.      Else

i.      Create a local variable set equal to JOptionPane.showConfirmDialog static method call prompting the human player if they accept the trump suit

ii.      If the human player’s response is true,

1.      Call method setAcceptTrump() passing as an argument the value true

iii.      Else

1.      Call method setAcceptTrump() passing as an argument the value false

 
Player.java 1.      Update class to add the following member variable

a.       boolean acceptTrump

2.      Generate a getter/setter for the member variable acceptTrump

 
images package    
userInterface package    
AiPlayerUi.java 1.      Update the class to add the following member variables

a.       GameUi gameUi

2.      Modify the custom constructor to do the following

a.       Add a third parameter of data type class GameUi

b.      On the member variable of class AiPlayer, call method setUi passing as an argument the parameter of class GameUi

 
GameUi.java 1.      Update the class to add the following member variables

a.       JPanel trumpPanel (if you added bidPanel in the last assignment, please rename it)

b.      JLabel teamOneScoreLbl

c.       JLabel teamOneScore

d.      JLabel teamTwoScoreLbl

e.       JLabel teamTwoScore

f.        JLabel trumpCard

 
  2.      Update initComponents to do the following

a.       Trump Panel

1.      Instantiate the JPanel member variable for the trump panel

2.      Instantiate the JLabel member variable for the trump label

3.      Instantiate an instance of class CardUi passing as arguments to the constructor the following

i.            JLabel member variable for the trump card

ii.            The trump card’s face value

iii.            The trump card’s suit

iv.            Update the JLabel member variable for the trump to do the following

a.       setting it equal to method call getLabel on the instance of class CardUi

b.      add client property passing arguments “face” and the trump card’s face value

c.       add client property passing arguments “suit” and the trump card’s suit

v.            Add the trump card JLabel the the trump panel

4.      Add the trump JPanel to the north JPanel

b.      Score Panel

1.      Use layout manager GridLayout so it is a 2 x 2 grid

2.      Instantiate the following member variables of class JLabel

i.            teamOneScoreLbl with text “Team One”

ii.            teamOneScore with text using the following method call: game.getTeams().get(Constants.ONE).getTeamScore()

iii.            teamOneScoreLbl with text “Team Two”

iv.            teamOneScore with text using the following method call: game.getTeams().get(Constants.TWO).getTeamScore()

3.      Add the four JLabels to the score JPanel

4.      Add the score JPanel the the north JPanel

c.       For the four player JPanels, aiOnePanel, aiTwoPanel, aiThreePanel, and hpPanel

1.      Add an additional argument to the constructor calls a reference to this class, GameUi

 
HumanPlayerUi.java 1.      Update the class to add the following member variables

a.       GameUi gameUi

2.      Modify the custom constructor to do the following

a.       Add a second parameter of data type class GameUi

1.      On the member variable of class HumanPlayer, call method setUi passing as an argument the parameter of class GameUi

 
Euchre application    
Test Cases Test Cases pass  
  Source compiles with no errors  
  Source runs with no errors  
  Source includes comments  
Total    

 

 

 

Perform the following test cases

Test Cases
  Action Expected outcome
Test Case 1 Regression Testing: Initial JOptionPane displays JOptionPane is similar to figure 1
Text Case 2 Regression Testing: JOptionPane Prompts User Name JOptionPane is similar to figure 2
Test Case 3 Euchre Initial UI displays Game UI looks similar figure 3 where:

1.      The score panel displays

2.      The trump panel displays

Test Case 4 Regression Testing: Project view Project view matches figure 4
Test Cases 5, 6, 7, 8 The result of each player accepting or rejecting the trump suit should display Game UI looks similar to figures 5, 6, 7, and 8
Test Case 9 The team that called trump UI looks similar to figure 9

 

 

Figure 1 Intro JOptionPane

 

 

Figure 2 Prompt for User’s Name

 

Figure 3 Euchre Initial UI

 

 

 

 

Figure 4 Project View

Figure 5 Lead Player

 

Figure 6 Next Player

 

Figure 7 Next Player

 

Figure 8 Dealer

 

 

Figure 9 Trump Team

 

  • Assignment_7.zip