import java.util.
Random;
import java.util.Scanner;
public class GuessTheNumberGame {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Random random = new Random();
int lowerBound = 1;
int upperBound = 100;
int numberToGuess = random.nextInt(upperBound - lowerBound + 1) + lowerBound;
int attempts = 0;
System.out.println("Welcome to the Guess the Number game!");
System.out.println("I've selected a random number between " + lowerBound + " and " +
upperBound + ".");
while (true) {
System.out.print("Enter your guess: ");
int userGuess = scanner.nextInt();
attempts++;
if (userGuess < lowerBound || userGuess > upperBound) {
System.out.println("Please enter a number between " + lowerBound + " and " + upperBound +
".");
} else if (userGuess < numberToGuess) {
System.out.println("Try higher.");
} else if (userGuess > numberToGuess) {
System.out.println("Try lower.");
} else {
System.out.println("Congratulations! You've guessed the number " + numberToGuess + " in " +
attempts + " attempts.");
break;
scanner.close();
}import java.util.Random;
import java.util.Scanner;
public class BonusWheelOfFortune {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Random random = new Random();
String[] prizes = { "Cash Prize", "Extra Life", "Double Points", "Try Again", "Lose a Turn" };
System.out.println("Welcome to the Bonus Wheel of Fortune!");
System.out.println("Spin the wheel and see what you win!");
while (true) {
System.out.print("Press Enter to spin the wheel or 'q' to quit: ");
String input = scanner.nextLine();
if (input.equals("q")) {
break;
int randomIndex = random.nextInt(prizes.length);
String prize = prizes[randomIndex];
System.out.println("You've won: " + prize);
System.out.println("Thanks for playing the Bonus Wheel of Fortune!");
scanner.close();