-4
The idea of the game is to use a Random from 1 to 100 and the user to hit, when the number of the user is higher, send a message warning the user, in the same way if it is smaller and giving more chances for the user to hit.
The code itself is not compiling and I’m not finding the error
public static void main(String[] args) {
Random rand = new Random();
int numeroSorte = rand.nextInt(100) + 1;
System.out.println("Adivinhe o numero que estou pensando, ele esta entre 1 e 100");
boolean continuar = true;
Scanner scan = new Scanner(System.in);
while (continuar) {
System.out.print("digite um numero ");
int numeroUsuario = Integer.valueOf(scan.next());
if (numeroUsuario == numeroSorte) {
System.out.println("Parabens Voce acertou o numero ! ^^ ");
continuar = false;
} else if (numeroUsuario < numeroSorte) {
System.out.println("o numero " + numeroUsuario + "é menor que o meu numero");
} else {
System.out.println("o numero " + numeroUsuario + "é maior que o meu numero");
}
}
scan.close();
}
}
Please read this: https://pt.meta.stackoverflow.com/a/5485/28595
– user28595
The proxy on the network here blocks photos from most photo sharing domains, such as Imgur (used by the stack overflow), post the code if not me and a lot of people won’t be able to see anything. Another thing, seeks to write correctly, Your use of
c
as beingse
made me confuse twice the reading, no need to be an expert in Portuguese, but avoid unnecessary abbreviations.– Guilherme Nascimento
You have not imported the required classes. You are also not using the operator
new
correctly– Jefferson Quesado
Thanks for the help, I fixed the error of using the photo, in the next questions I will not use photo
– Dennys Kaluzny