Related questions
This question is in Java.
2D Array Game.
Have the program fill a 10 row by 10 column 2D array with random integer numbers between 1 and 100 inclusive.
Have the user enter a guess for a number and search the array keeping track of how many times that number appears.
Have the computer pick a number and search the array keeping track of how many times that number appears.
If the user’s number appears more often, the user wins.
If the computer’s number appears more often, the computer wins.
If they appear the same number of times. It is a tie.
At the end, print out
Player’s Guess: (prints #) Number of occurances: (prints #)
Computer’s Guess: (prints #) Number of occurrences: (prints #)
Winner: (prints player or computer based on who won)
At the end, it asks if the player wants to play again. If they do, it generates a new set of numbers for the array.
Make sure you take account of common errors.
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 6 images
- In JAVAarrow_forwardIN JAVA Given an array, write a program to print the array elements one by one in a new line. If the array element is divisible by 4, print Four. If it is divisible by 6, print Six. If it is divisible by both 4 and 6, print Four Six. Use the following input array Int[] input_array = {2, 5, 10, 8, 18, 24, 3, 48, 30, 9, 12} Output should be 2 5 10 Four Six Four Six 3 Four Six Six 9 Four Sixarrow_forwardSolve by javaarrow_forward
- For Java. Create a program that can read N integer numbers, store them in an array and then use a method to calculate and return the average of all numbers. Refer to photo.arrow_forwardJAVA PROGRAM Write a program that asks the user to input two integers a and b. Then create an array that has all integer from a to b. Print out the array. (Don’t forget to consider the situation of a=b, a<b, and a>b.) Example 1: Input two numbers: 6 2 Array is [6, 5, 4, 3, 2] Example 2: Input two numbers: 4 8 Array is [4, 5, 6, 7, 8] Pass the above array as a parameter to a method called average and return the average and print it out in the main method. (Do not use Math library to get the average.)arrow_forward
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY