There are many ways to design a solution to this problem but you are evaluated on meeting the specific specifications as given.
1. Use proper statement indentation and meaningful variable names in the code.
2. Place a multi-line Javadoc comment giving a description of this application and the rules of the game. Include your name and the date with the description. Also include descriptive Javadoc comments for each class and method in the project.
3. Output spacing, formatting, and spelling are to match the example output illustrated above, but of course the user input can be different.
4. Add a meaningful comment for every statement explaining why the statement is in the code.
5. Generate Javadoc html files.
6. Create a class to create objects to be used in this application. Name the class Player with only these instance variables:
7. Create and use, as necessary, getter and setter methods for the instance variables.
8. Create and use a Player constructor that has the first and last names as the only two parameters.
9. Use the Console class (or a modified version) given in chapter 7 in this application.
10. Use a LinkedList or ArrayList in the application to store Player objects.
11. Use arrays as needed.
12. The value of the dropped card is determined randomly.
13. To limit the number of parameters to pass between methods use static fields only to declare the Scanner and List used in the application. Do not declare any other static fields.
14. Create and use an Enumeration to store the constant for YELLOWS and REDS. Include and use a toString() method to display the constants as illustrated in the example output.
15. Place the Enumeration, the Console class, and the class with the main method in a package named PPQ2App. Place the Player class in a package named Business. These should be the only classes in the project.
16. Validate the data so only acceptable values will be processed (3 points). If the user enters invalid data, the application should display the appropriate error message and prompt the user again until the user enters valid data. See example output above.
17. The application must contain and implement these five methods. Name them as indicated. The functionality each method will perform in the application is summarized below.
Welcome to the Game
Here is how the game is played:
Each of two players drop a card a number of times.
Whatever side the card lands on is stored.
After both players have dropped the card a user-defined number of times
the player with the most Yellows is the winner.
If both players have the same number of Yellows, it is a tie.
The number of drops must be greater than 1 and less than or equal to 25:
How many times should each player drop the card? 222
Error! Number must be less than 26.
How many times should each player drop the card? 25
Enter a player’s first name: bob
Enter a player’s last name: smith
Good luck bob, you are ready to play the game.
Enter a player’s first name: Jane
Enter a player’s last name: Jones
Good luck Jane, you are ready to play the game.
bob smith,
It is time to drop the card 25 times.
Enter 0 to start dropping. 0
Yellow
Yellow
Yellow
Yellow
Yellow
Yellow
Yellow
Yellow
Red
Yellow
Red
Red
Yellow
Yellow
Red
Red
Red
Yellow
Yellow
Yellow
Red
Red
Red
Red
Red
Jane Jones,
It is time to drop the card 25 times.
Enter 0 to start dropping. 0
Red
Red
Red
Yellow
Red
Red
Red
Red
Yellow
Yellow
Red
Yellow
Yellow
Yellow
Yellow
Red
Yellow
Red
Red
Yellow
Red
Yellow
Yellow
Yellow
Yellow
The result of the game is:
Congratulations bob! you have won the game with 14 Yellows.
Play Again? (yes/no) yes
Welcome to the Game
Here is how the game is played:
Each of two players drop a card a number of times.
Whatever side the card lands on is stored.
After both players have dropped the card a user-defined number of times
the player with the most Yellows is the winner.
If both players have the same number of Yellows, it is a tie.
The number of drops must be greater than 1 and less than or equal to 25:
How many times should each player drop the card? ten
Error! Invalid integer. Try again.
How many times should each player drop the card? -1
Error! Number must be greater than 1.
How many times should each player drop the card? 0
Error! Number must be greater than 1.
How many times should each player drop the card? 1
Error! Number must be greater than 1.
How many times should each player drop the card? 2
Enter a player’s first name: Bob
Enter a player’s last name: Smith
Good luck Bob, you are ready to play the game.
Enter a player’s first name: jane
Enter a player’s last name: jones
Good luck jane, you are ready to play the game.
Bob Smith,
It is time to drop the card 2 times.
Enter 0 to start dropping. 1
Error! Number must be less than 1.
Enter 0 to start dropping. s
Error! Invalid integer. Try again.
Enter 0 to start dropping. 0
Yellow
Yellow
jane jones,
It is time to drop the card 2 times.
Enter 0 to start dropping. 0
Red
Red
The result of the game is:
Congratulations Bob! you have won the game with 2 Yellows.
Play Again? (yes/no) y
You must enter yes or no. Try again.
Play Again? (yes/no) yes
Welcome to the Game
Here is how the game is played:
Each of two players drop a card a number of times.
Whatever side the card lands on is stored.
After both players have dropped the card a user-defined number of times
the player with the most Yellows is the winner.
If both players have the same number of Yellows, it is a tie.
The number of drops must be greater than 1 and less than or equal to 25:
How many times should each player drop the card? 3
Enter a player’s first name: bob
Enter a player’s last name: smith
Good luck bob, you are ready to play the game.
Enter a player’s first name: Jane
Enter a player’s last name: Jones
Good luck Jane, you are ready to play the game.
bob smith,
It is time to drop the card 3 times.
Enter 0 to start dropping. 0
Red
Red
Yellow
Jane Jones,
It is time to drop the card 3 times.
Enter 0 to start dropping. 0
Red
Red
Yellow
The result of the game is:
No player won this game. It was a tie.
Play Again? (yes/no) no
I hope you enjoyed the game. Come back soon.