PROGRAMMING AND CODE


Assignemnt #57

Code

/// Name: Justin Li
/// Period 7
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished: 12/2/15

import java.util.Scanner;
import java.util.Random;

class dice {
  
    public static void main(String[]args) {
      
        Random r = new Random();
        
        Scanner keyboard = new Scanner(System.in);
        
        int one, two, total;
        one = 1 + r.nextInt(6);
        two = 1 + r.nextInt(6);
        total = one + two;
        
        System.out.println("Roll #1: " + one);
        System.out.println("Roll #2: " + two);
        System.out.println("\nThe total is " + total);
        
          
    }
}
    

Picture of the output

Assignment 1