Description
Assignment Scope
- Add member variables to classes
- Generate getters/setters for member variables
- Write custom constructors
- Add method signatures to an interface
- Implement an interface so that methods are declared as abstract
- Implement abstract methods in inherited classes
- Write methods to accomplish specific tasks for a class
- Create enumerations as constants
- Compile and run a project
- Compress a project and submit to Webcourses
- Decompress compressed project and verify it is a Netbeans project
References
- docx
- Setting up a project in Netbeans.docx
- Netbeans right click menu help.docx
Deliverables
To complete this assignment you must submit your compressed Netbeans project to Webcourses.
Tasks
Activity | |
Euchre project | Create a new Java Application project named Euchre
allowing Netbeans IDE to create the main class called Euchre.java |
Euchre 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:
1. A constant for the number of AI players set to the value of 3 2. A constant for the number of cards in a Euchre deck set to the value of 24 3. A constant for the number of cards each player is dealt set to the value of 5 4. A constant for the number of rounds in a hand set to the value of 5 5. An enumeration for the color of cards so it includes: RED and BLACK 6. An enumeration for the suit of cards so it includes: CLUBS, DIAMONDS, HEARTS, SPADES 7. An enumeration for the face value of cards so it includes: NINE, TEN, JACK, QUEEN, KING, ACE |
core package | |
AiPlayer class | Implement methods inherited from class Player:
1. public Card playCard(); 2. public int makeTrump(); |
Card class | 1. 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 |
Deck class | 1. Add member variable
a. Data type Set<Card> to represent the deck of cards 2. Generate getter/setter for member variables |
Game class | 1. Add member variables
a. Data type enumeration Suit to represent the trump suite of Euchre b. Data type class Player to represent the lead player for each hand c. Data type class Player to represent the dealer for each hand d. Data type class Player to represent which player won the current trick/hand e. Data type int to represent the current round of the game f. Data type ArrayList<Team> to represent the two teams of the game g. Data type class Deck to represent the deck of cards for the game h. Data class Scanner to get information from the user 2. Generate getters/setters for the member variables 3. Write a custom constructor that a. Has no parameters b. Calls method createTeams() which will be defined within this class c. Calls method outputTeams() which will be defined within this class 4. Write method createTeams() that a. Has no parameters b. Has return type void c. Instantiate the member variable of type ArrayList<Team> d. Instantiates two instances of class Team i. one for TeamOne ii. one for TeamTwo iii. set names for each team as appropriate iv. add each instance to the ArrayList<Team> member variable e. Instantiate the member variable of class Scanner passing “System.in” as the argument to the constructor f. Using System.out.println() static method, prompt the user for the human player’s name g. Instantiate an instance of class String set equal to the reference object of class Scanner using its method .next() h. Instantiate an instance of class HumanPlayer i. Call method .setName() on the reference object of class HumanPlayer passing the value stored in the variable from step g. above j. Add the reference object of class HumanPlayer to the instance of class Team representing Team One k. Write a for loop to generate three AiPlayer instances i. Generate a unique name for each AiPlayer and call method .setName() passing the unique name as an argument ii. Add one AiPlayer instance to the instance of class Team representing Team One iii. Add the other two AiPlayer instances to the instance of class Team representing Team Two 5. Write method outputTeams() so that a. It has no parameters b. Has a return type of void c. Uses an enhanced for loop to loop through the collection of member variable of type ArrayList<Team> 1. Calls method outputTeam() in class Team |
HumanPlayer class | Implement methods inherited from class Player:
1. public Card playCard(); 2. public int makeTrump(); |
IPlayer interface | Add method signatures:
1. public Card playCard(); 2. public void makeTrump(); |
Player class | 1. Add member variables:
a. Data type String to represent player name 2. Generate getters/setters for the member variables 3. Declare abstract the methods inherited from interface IPlayer a. public abstract Card playCard(); b. public abstract int makeTrump(); |
Team class | 1. Add member variables
a. Data type ArrayList<Player> to represent a team b. Data type int to represent the team’s score c. Data type int to represent the team’s tricks taken for each hand d. Data type String to represent the team’s name 2. Generate getters/setters for the member variables 3. Write a custom constructor that instantiates the member variable ArrayList<Player> 4. Write method outputTeams() so that a. It has no parameters b. Has a return type of void c. Outputs the current Team’s name d. Uses an enhanced for loop to loop through the collection of class Team’s member variable ArrayList<Player> i. Outputs the current Player’s name |
userinterface package | Create package userinterface |
Euchre application | |
Test Case 1 | Test Case 1 passes |
Test Case 2 | Test Case 2 passes |
Test Case 3 | Test Case 3 passes |
Source compiles with no errors | |
Source runs with no errors | |
Source includes comments |
Perform the following test cases
Test Cases | ||
Action | Expected outcome | |
Test Case 1 | Project view | Completed project view should look like figure 1 |
Test case 2 | Run application | The console window should look like figure 2 |
Test case 3 | Regression testing; Run application | The JOptionPane.showMessageDialog() method call should look like figure 3 |
Figure 1 Project View
Figure 2 Output in console window
Figure 3 Display from JOptionPane.showMessageDialog() method