I am attempting to create a program for class that flips a coin 1000 times and counts the number of heads and tails. I have to use the following methods in this class:

public boolean isHeads(); returns true if heads

void flip();flips the coin. I also have to use Math.random here and im not 100% on this

String toString(); outputs the current face of the coin

here is what i have so far any guidance would be a blessing. Thank you.

my errors are with the myCoin.flip because the "." im not sure what to put as my if statement. i believe i have confused myself.public class Coin { int TAILS; int HEADS; double randomNum; void flip() { flip(); randomNum = (int)Math.random(); } public boolean isHeads() { return (randomNum == HEADS); } public String toString() { String faceName; if (randomNum == HEADS) faceName = "HEADS"; else faceName = "TAILS"; return faceName; } public static void main(String[] args) { Coin myCoin = new Coin(); int h = 0; int t = 0; for(int flips = 0; flips < 1000; flips++) { if (myCoin.flip < 0.5) h++; else t++; } } }