Assignemnt #57 and Dice
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Forty-Seventh Program
/// file name: Dice.java
/// date finished: 11/20/15
import java.util.Random;
import java.util.Scanner;
public class Dice
{
public static void main ( String[] args )
{
Random r = new Random();
int num1 = 1 + r.nextInt(6);
int num2 = 1 + r.nextInt(6);
System.out.println("Here comes the dice!");
System.out.println("");
System.out.println("Roll 1: " + num1);
System.out.println("Roll 2: " + num2);
System.out.println("");
int total = num1 + num2;
System.out.println("Your total is " + total);
}
}
Picture of the output