Assignment Scope
- Add methods to classes to accomplish specific tasks
- Use class HashSet
- Convert a HashSet to an ArrayList
- Convert an ArrayList to a HashSet
- Iterate through a HashSet
- Generate objects of specific classes
- 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 | |
Euchre class | |
constants | |
Constants class | |
core package | |
AiPlayer class | |
Card class | Update class to include:1. Method hashCode, it shalla. Return type intb. Receive no parametersc. Include local variable hashCode of data type int initialized to the value of zerod. Concatenate member variable face and its hashcodee. Concatenate member variable value and its hashcodef. Concatenate member variable color and its hashcodeg. Return the local variable hashCode2. Method equals, it shalla. Return type booleanb. Receive one parameter of data type Objectc. Check if the parameter is an instanceof class Cardi. If true1. Explicitly convert the parameter to an instance of class Card2. Return the result of comparing if the face, suit, and color match an existing object3. Code example:return (card.face.equals(this.face) &&card.color.equals(this.color) &&card.suit.equals(this.suit));ii. Else1. Return false |
Deck class | Update class to1. Write a custom constructor thata. Receives no parametersb. Calls method generateDeck()c. Calls method displayDeck()d. Calls method shuffleDeck()e. Calls method displayDeck()2. Write method generateDeck so thata. Return type is voidb. Receives no parametersc. Instantiates the member variable of type Set calling the constructor for class HashSetd. Loops through the values of enumeration Facei. Loops through the values of enumeration Suit1. Instantiates an instance of class Card2. Sets the face value of the card3. Sets the suit of the card4. Determines the color of the card based on the suit and sets the color of the card5. Verifies the instance of Card created is not contained in the HashSet of cardsa. If it does not exist, add the instance of class Card to the HashSet3. Write method displayDeck so thata. Return type is voidb. Receives no parametersc. Iterates through the HashSet collection outputting to the console the face value, suit, and color of each card4. Write method shuffleDeck so thata. Instantiates an instance of class ArrayList, explicitly for data type of class Card passing the member variable of interface Set as an argumentb. Call static method Collections.shuffle passing the ArrayList from above as an argumentc. Reinstantiate the member variable of interface Set by calling the constructor for class HashSet passing the ArrayList above as an argument |
Game class | Update class to1. Update the custom constructor to call method generateDeck()2. Add method generateDeck so thata. Return type is voidb. Receives no parametersc. Instantiates the member variable of class Deckb. |
HumanPlayer class | |
IPlayer interface | |
Player class | |
Team class | |
userinterface package | |
Euchre application | |
Test Case 1 | Test Case 1 passes |
Test Case 2 | Test Case 2 passes |
Test Case 3 | Test Case 3 passes |
Test Case 4 | Test Case 4 passes |
Test Case 5 | Test Case 5 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 | Regression testing; 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 |
Test case 4 | Run application | The console window should look similar to figure 4 for the initial display of the deck of cards |
Test case 5 | Run application | The output in the console window should display the deck of cards after being shuffled and should NOT be in the same order as the first output, similar to figure 5 |
Figure 1 Project View
Figure 2 Output in console window
Figure 3 Display from JOptionPane.showMessageDialog() method
Figure 4 Initial display of deck of cards
Figure 5 Display of deck of cards after shuffle
Reviews
There are no reviews yet.