import java.util.Random;
import java.util.Scanner;
public class John {
public static void main(String[] args) {
System.out.println("Welcome to guessing game!");
Random rand = new Random();
int numberToGuess = rand.nextInt(10);
int numberOfTries = 0;
Scanner input = new Scanner(System.in);
int guess;
int Round;
int target;
int points;
char play;
int error;
do{
Round=1;
points=0;
error=0;
while (Round<=3){
target = rand.nextInt(9) + 1;
System.out.println("please enter a number betwwen 1 to 10");
guess = input.nextInt(10);
numberOfTries++;
if (guess == numberToGuess){
System.out.println("you win!");
System.out.println("the number was " +numberToGuess);
points=points+100;
}
else if(guess < numberToGuess){
System.out.println("your guess is too low");
error=error+0;
}
else if (guess > numberToGuess){
System.out.println("your guess is too high");
}
Round=Round+1;
}
System.out.println("your points");
System.out.println("you have"+""+points+""+"pts.");
System.out.println("you commited"+error+""+ "errors");
System.out.println("It took you " + numberOfTries + " tries");
System.out.println("Game over");
System.out.print("do you want to play again?:");
play=input.next().charAt(0);
}while(play=='Y'||play=='y');
System.out.println("Thank you!");
}
}