Use the scenario below for help answering 1(A), (B) and (C). This is using Java. The Scenario: You have a class named HeartsPlayer A round of Hearts starts with every player having 13 cards Players then choose 3 cards to “trade” with a player (1st you pass left, 2nd you pass right, 3rd you pass across, 4th you keep) Players then strategically play cards in order to have the lowest score At the end of the round, points are cumulatively totaled for each player. If one player’s total is greater than 100, the game ends and the player with the lowest score wins. Guide:
Use the scenario below for help answering 1(A), (B) and (C).
This is using Java.
The Scenario:
- You have a class named HeartsPlayer
- A round of Hearts starts with every player having 13 cards
- Players then choose 3 cards to “trade” with a player (1st you pass left, 2nd you pass right, 3rd you pass across, 4th you keep)
- Players then strategically play cards in order to have the lowest score
- At the end of the round, points are cumulatively totaled for each player.
- If one player’s total is greater than 100, the game ends and the player with the lowest score wins.
Guide:
Static & Not Final Field: Accessed by every object, Changing
Non-Static & Final Field: Accessed by object itself, Non-Changing
Static & Final: Accessed by every object, Non-Changing
Non-Static & Not Final Field: Accessed by object itself, Changing
1. How should the following data fields be defined (with respect to final and static)?
(a) playerPosition (These have values of North, South, East, or West)
- Is this: Static & Not Final Field?
- Is this: Non-Static & Final Field?
- Is this: Static & Final?
- Is this: Non-Static & Not Final Field?
(b) directionOfPassing
- Is this: Static & Not Final Field?
- Is this: Non-Static & Final Field?
- Is this: Static & Final?
- Is this: Non-Static & Not Final Field?
(c) totalScore (This would be the total score for each individual player)
- Is this: Static & Not Final Field?
- Is this: Non-Static & Final Field?
- Is this: Static & Final?
- Is this: Non-Static & Not Final Field?
Step by step
Solved in 2 steps