Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose you are writing a game-playing program that involves 2-digit numbers. First, generate a random 2-digit number. The user will try to guess this number
Suppose you are writing a game-playing program that involves 2-digit numbers. First, generate a random 2-digit number. The user will try to guess this number in at most 10 attempts. While getting input from the user give a hint if a match was found (0/1/2 digits match). Test for errors in input (including type check). Use the sample output to fully understand the program requirements.
How do I fix this?
import java.util.Scanner; import java.util. Random; public class Guess{ public static void main(String[] args) { //print output System.out.println("Try to guess my secret two-digit number, and I'll tell you how " + "many digits from your guess appear in my number."); Scanner input = new Scanner(System.in); int flag=1, rem1, rem2, divide1, divide2; Random ran = new Random(); int ran_inti = ran.nextInt(100)+10; for(int i=1;iStep 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