I am using a Random number class and asking it to add up the total heads/amount of flips.... but it's not working.
Any hints would be helpful.
import java.util.Random;
public class FlipaCoin
{
public static void main(String [] args)
{
Random rand= new Random();
boolean a;
while (a=true)
{
int flip=rand.nextInt(2);
int heads=0;
if (flip==1)
{
heads++;
}
double count=0;
double percentage=heads/count;
System.out.println(percentage);
count++;
if (percentage==50.0)
{
break;
}
}
}
}