Question
Create a java program that plays a game with 4 players Avoiding using arrays and continue, break statements. Use at least 3 methods in the
Create a java program that plays a game with 4 players
Avoiding using arrays and continue, break statements.
Use at least 3 methods in the program.
In the beginning, each of the four players would be asked to enter their name and the amount of money they want to bet(check if the money is between 0 and 100).
The sum of the bets will be the prize money for the game.
The users will then be asked to select one set of words they will together all use for the game.
The options are:
Sports, Animals, and Cars (can use numbers to represent the data sets)
Each set of words must contain at least 7 options (use numbers to represent the options).
For example. If the player chooses Cars, the possible options will be BMW, Toyota etc.
The game would repeat 7 times
players are required to enter a word from the word set theyve chosen together and the program should randomly generate a word (it means to generate a number randomly that represents the word) from that word set and display it.
For instance, user 1 choose basketball from the sports data set
User 2 chooses baseball from the sports data set, etc.
The computer had chosen basketball.
The user who got the correct answer would win one point.
The computer would then display the winner after 7 rounds of play.
The player with the most points will win all the money. (If someone gets the same point, they will share the price money)
For instance, Will won 100$. CONGRATULATIONS.
Then, the program would record the result and write to a file named winner.txt.
For instance, Will won 100$. CONGRATULATIONS.
Finally, it would ask the user to enter yes(y) if they want to play again.
Each time the result would be appended to the existing winner.txt file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started