random number if else
843785Oct 13 2008 — edited Oct 13 2008this is the code, why is it saying it expects a ( when it is already present in the string
import java.util.Random; //program uses class Random
import java.util.Scanner;
public class NumberGame
{
public static void main(String[] args)
{
Random randomNumbers = new Random(); //random number genreator
Scanner in = new Scanner(System.in);
int randomValue = randomNumbers.nextInt(101);
int number = generator.nextInt(100) + 1;
int on_off = 1;
while(on_off == 1){
System.out.print("Guess a number between 1 and 100: ");
int guess = in.nextInt();
{
if
(guess < number but within 5)
{
System.out.println("Hot");
}
{
if(guess < number but within 10){
System.out.println("Warm");
}
{
if(guess > number but by no more than 5){
System.out.println("Cool");
}
{
if(guess > number but by no more than 10){
System.out.println("Cold");
}
if(guess == number){
System.out.println("Correct! You win!");
on_off = 0;
}
}
}