Question
Write a java program that plays a gambling game with 4 users Do not use arrays and continue, break statement. Use at least 3 methods
Write a java program that plays a gambling game with 4 users
Do not use arrays and continue, break statement.
Use at least 3 methods in the program.
In the beginning, the four players would be asked to enter their name and the amount of money they each want to bet.
The total 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, foods, and colors (can use numbers to represent the data sets)
Each set of words must contain 5 options (can use numbers to represent the options).
For example. If the user chooses Sports, the options will be basketball, baseball, etc.
The game would then repeat 5 times
Each of the users would enter a word from the set theyve all chosen together and the computer would randomly generate a word (generate a random number that represents the word) from that set and display it.
For instance, user 1 choose basketball from the sports data set
User 2 choose baseball from the sports data set
Finally, the computer had chosen basketball.
The user who got the correct answer would win one point.
The computer would then display the user who won the game after 5 rounds of play.
The player with the most points will win all the money. (If someone got the same points, they will share the price money evenly)
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