import java.util.Random;
public class flip {
int head = 0;
int tail = 0;
public static void main (String[] args){
double start = 0;
double end = 1;
double random = new Random().nextDouble();
double result = start + (random * (end - start));
System.out.println(result);
if (result < 0.5){
System.out.println("head");
}else if (result > 0.5 && result < 1.0){
System.out.println("tail");
}
}
}
currently i am trying to make the coin flip 10 times and display how much times heads and tails come out. However i cant use any loops so i know i have to call my if method 10x. i just don't know how to lay that out properly and make all the data from the 10 method calls print out. I know i got to store it in my filed variables and then have a system.out.println print out the number in heads and tails.
any help please? thanks you