Question: Write a Java program named MatchEm that generate three random numbers between 1 and 5. Determine how many matched (zero, one, or two). List the

Write a Java program named MatchEm that generate three random numbers between 1 and 5. Determine how many matched (zero, one, or two). List the numbers next to each other and print out how many matched.

Add a for loop that does this process 20 times. After the loop, print out how many times there were zero matches, how many times there was one match, and how many times all three matched.

Alter your program so that the user can place a bet for each game. (They fill this in once they bet the same amount for each run). If there are zero matches, they lose two times that amount of money. If there is one match, they get two times their money bet. And if all three numbers match, they triple their bet. After each run, indicate how much was won for that run and the current amount of money won or lost for the match. SAMPLE OUTPUT: Write a Java program named MatchEm that generate three random numbers between

How much do you want to bet for each trial? 2@ 1. 521 None matched. The current balance is $40.00 2. 131 Two values matched. The current balance is $0.00 3. 545 Two values matched. The current balance is $40.00 4. 351 None matched. The current balance is $0.00 5. 111 All values matched. The current balance is $60.00 6. 314 None matched. The current balance is $20.00 7. 233 Two values matched. The current balance is $60.00 8. 542 None matched. The current balance is $20.00 9. 223 Two values matched. The current balance is $60.00 10. 554 Two values matched. The current balance is $100.00 11. 441 Two values matched. The current balance is $140.00 12. 214 None matched. The current balance is $100.00 13. 111 All values matched. The current balance is $160.00 14. 143 None matched. The current balance is $120.00 15. 343 Two values matched. The current balance is $160.00 16. 331 Two values matched. The current balance is $200.00 17. 121 Two values matched. The current balance is $240.00 18. 151 Two values matched. The current balance is $280.00 19. 311 Two values matched. The current balance is $320.00 20. 235 None matched. The current balance is $280.00 Surmary : Three matches : 2 TWO matches: 11 No matches: 7 Your bet was $20.00 and your final tally was $280.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!