Question: How to comment every line of this code (just comment what the code is, not how working) The code: import java.util.Scanner; public class RandomDie {

How to comment every line of this code (just comment what the code is, not how working)

 The code: 
import java.util.Scanner;  public class RandomDie {    public static void main(String[] args) {      int die1, die2, count = 0;     String choice = "Yes";      Scanner sc = new Scanner(System.in);      System.out.println("Hey! Welcome to Tina's Dice Game.\nLet's start!");      while (choice.equalsIgnoreCase("yes")) {        die1 = (int) (Math.random() * (6)) + 1;       die2 = (int) (Math.random() * (6)) + 1;        System.out.println("Dice 1 = " + die1);       System.out.println("Dice 1 = " + die2);        System.out.println("I got " + die1 + " and " + die2 + "!");       if ((die1 + die2) % 2 == 0) {         System.out.println("Evens are better than odds!");       } else {         System.out.println("Odds are still cool!");      }        count++;        System.out.println("Do you want to play again. Enter \"yes\" to continue. ");        choice = sc.next();    }      System.out.println("The number of times the dice was thrown is: " + count);     System.out.println("Nice game!\nThanks for playing, Come play again soon!");    } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

java Importing the Scanner class from javautil package import javautilScanner Defining a public clas... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!