Assignemnt #57 Dice

Code

    ///Name: Morgan Kaplan
    ///Period: 5
    ///Project Name: Dice
    ///File Name: Dice.java

import java.util.Random;

public class Dice
{
	public static void main ( String[] args )
	{
		Random r = new Random();

		int x = 1 + r.nextInt(6), z= 1 + r.nextInt(6);
        String response="", response1="";
		
        if ( x==1)
        response= " 1 ";
		else if ( x==2)
        response= " 2 ";
        else if ( x==3)
        response= " 3 ";    
        else if ( x==4)
        response= " 4 ";
        else if ( x==5)
        response= " 5 ";
        else if ( x==6)
        response= " 6 ";

            if ( z==1)
        response1= " 1 ";
		else if ( z==2)
        response1= " 2 ";
        else if ( z==3)
        response1= " 3 ";    
        else if ( z==4)
        response1= " 4 ";
        else if ( z==5)
        response1= " 5 ";
        else if ( z==6)
        response1= " 6 ";
            
    System.out.println( " Roll # 1 = " + response + " ");
    System.out.println( " Roll # 2 = " + response1 + " ");
    System.out.println( " Your total is " + ( x + z ) + " ");
    }
}
    

Picture of Output

Assignment 57