the main purpose of this application is to ask the user for head or tail and the output the numbers of guesses + the percentage of correct. Im having trouble with finding the percentage of correct. please help me fix this problem
public class FlipCoin
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
Random r = new Random();
int user;
int answer = r.nextInt(2)+1;
int quit = -1;
int Guess = 0;
int percent;
do {
System.out.println("1 for head and 2 for tails:");
user = in.nextInt();
Guess += 1;
System.out.println("Type in 1 for heads and Type 2 for Tails.");
System.out.println("Press" +" "+ (quit) +" "+ "to Quit.");
answer = r.nextInt(2)+1;
int HEAD = 1;
int TAIL = 2;
if (user == answer)
System.out.println("You win!");
else if (user != answer)
System.out.println("Try again!");
percent = ((HEAD/TAIL)*100);
}while (user != -1);
System.out.println("You made" +" "+ Guesses +" "+ "guess");
System.out.println("You Quit!");
System.out.println(percent+"Percent");
}
}