Assignment # 57 and Dice
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: Dice
/// File Name: Dice.java
/// Date: 12/2/2015
import java.util.Scanner;
import java.util.Random;
public class Dice
{
public static void main(String[] args)
{
Random r = new Random();
byte roll1 = (byte)(1 + r.nextInt(6));
byte roll2 = (byte)(1 + r.nextInt(6));
System.out.println();
System.out.println("Roll the dice!");
System.out.println();
System.out.println("Roll#1 "+roll1);
System.out.println();
System.out.println("Roll#2 "+roll2);
System.out.println();
System.out.println("Total is "+(roll2+roll1));
System.out.println();
}
}
Picture of the output