Question: Please help me comment these lines of code. Please not these are just some lines of code that have been taken from the java program
Please help me comment these lines of code. Please not these are just some lines of code that have been taken from the java program I am creating which is a coin toss program. I do not need you to create one. Just comment what the lines of code below
private static String sideUp;
}
public void toss() { Random in = new Random(); int x = in.nextInt(); if (x % 2 == 0) sideUp = "Heads"; else sideUp = "Tails"; }
public static void main(String[] args) { int tail = 0, head = 0;
System.out.println(" Tossing coin 20 times:-"); for (int i = 1; i <= 20; i++) { coin.toss(); if (coin.getFace().equals("tails")) tail++; else head++;
. any updateStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
