Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 update

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

How to Calculate the Regression Line

Answered: 1 week ago

Question

Solve all these practices problems

Answered: 1 week ago