How to comment every line of this code (just comment what the code is, not how working)
Fantastic news! We've Found the answer you've been seeking!
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 {
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!");
} }
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date: