Bellevue College
CS 210
/Jeremiah Smith //CS 210 //Guessing Game //This program prompts the user to guess a number until they guess it correctly import java.util.Random; import java.util.Scanner; public class GuessingGame { public static void main(String[] args) { Scanner console = new Scanner(System.in); Random r = new Random(); int countsum = 0; int games = 0; int bestgame
...[Show More]
/Jeremiah Smith //CS 210 //Guessing Game //This program prompts the user to guess a number until they guess it correctly import java.util.Random; import java.util.Scanner; public class GuessingGame { public static void main(String[] args) { Scanner console = new Scanner(System.in); Random r = new Random(); int countsum = 0; int games = 0; int bestgame = 1000000; boolean start = true; //The start of the program is a boolean so it can be replayed while (start) { int count = 0; games++; System.out.println("Im thinking of a number between 1 and 100..."); System.out.println("Your guess? "); int guess = console.nextInt(); count++; int comguess = r.nextInt(100) + 1; //The program will keep going until the user guesses correctly while (guess != comguess)
[Show Less]