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 Euchreallowing 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 32. A constant for the number of cards in a Euchre deck set to the value of 243. A constant for the number of cards each player is dealt set to the value of 54. A constant for the number of rounds in a hand set to the value of 55. An enumeration for the color of cards so it includes: RED and BLACK6. An enumeration for the suit of cards so it includes: CLUBS, DIAMONDS, HEARTS, SPADES7. 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 cardb. Data type enumeration Suit to represent the suit of the cardc. Data type enumeration Color to represent the color of the card2. Generate getters/setters for member variables |
Deck class | 1. Add member variablea. Data type Set<Card> to represent the deck of cards2. Generate getter/setter for member variables |
Game class | 1. Add member variablesa. Data type enumeration Suit to represent the trump suite of Euchreb. Data type class Player to represent the lead player for each handc. Data type class Player to represent the dealer for each handd. Data type class Player to represent which player won the current trick/hande. Data type int to represent the current round of the gamef. Data type ArrayList<Team> to represent the two teams of the gameg. Data type class Deck to represent the deck of cards for the gameh. Data class Scanner to get information from the user2. Generate getters/setters for the member variables3. Write a custom constructor thata. Has no parametersb. Calls method createTeams() which will be defined within this classc. Calls method outputTeams() which will be defined within this class4. Write method createTeams() thata. Has no parametersb. Has return type voidc. Instantiate the member variable of type ArrayList<Team>d. Instantiates two instances of class Teami. one for TeamOneii. one for TeamTwoiii. set names for each team as appropriateiv. add each instance to the ArrayList<Team> member variablee. Instantiate the member variable of class Scanner passing System.in as the argument to the constructorf. Using System.out.println() static method, prompt the user for the human players nameg. 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 HumanPlayeri. Call method .setName() on the reference object of class HumanPlayer passing the value stored in the variable from step g. abovej. Add the reference object of class HumanPlayer to the instance of class Team representing Team Onek. Write a for loop to generate three AiPlayer instancesi. Generate a unique name for each AiPlayer and call method .setName() passing the unique name as an argumentii. Add one AiPlayer instance to the instance of class Team representing Team Oneiii. Add the other two AiPlayer instances to the instance of class Team representing Team Two5. Write method outputTeams() so thata. It has no parametersb. Has a return type of voidc. 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 name2. Generate getters/setters for the member variables3. Declare abstract the methods inherited from interface IPlayera. public abstract Card playCard();b. public abstract int makeTrump(); |
Team class | 1. Add member variablesa. Data type ArrayList<Player> to represent a teamb. Data type int to represent the teams scorec. Data type int to represent the teams tricks taken for each handd. Data type String to represent the teams name2. Generate getters/setters for the member variables3. Write a custom constructor that instantiates the member variable ArrayList<Player>4. Write method outputTeams() so thata. It has no parametersb. Has a return type of voidc. Outputs the current Teams named. Uses an enhanced for loop to loop through the collection of class Teams member variable ArrayList<Player>i. Outputs the current Players 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
Reviews
There are no reviews yet.