Assignemnt #71: Shorter Double Dice

Code

    /// Name: Cassie
    /// Period: 6
    /// Program Name: Shorter Double Dice
    /// File Name: shortdie.java
    /// Date Finished: 1/14/2016
    
    import java.util.Random;
      
      class shortdie
      {
      	public static void main ( String[] args ) throws Exception
      	{
      		Random r = new Random();
              int die1, die2, attempts=0;
              
              do
              {
                  die1 = 1 + r.nextInt(6);
                  die2 = 1 + r.nextInt(6);
     
                      if ( die1 == 1 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|          |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|          |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die1 == 2 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O       |" );
                          System.out.println( "|          |" );
                          System.out.println( "|      O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die1 == 3 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O       |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|      O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die1 == 4 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die1 == 5 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O   O   |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|  O   O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die1 == 6 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      if ( die2 == 1 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|          |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|          |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die2 == 2 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O       |" );
                          System.out.println( "|          |" );
                          System.out.println( "|      O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die2 == 3 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O       |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|      O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die2 == 4 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die2 == 5 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O   O   |" );
                          System.out.println( "|    O     |" );
                          System.out.println( "|  O   O   |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                      else if ( die2 == 6 )
                      {
                          System.out.println( " __________" );
                          System.out.println( "|          |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|  O    O  |" );
                          System.out.println( "|          |" );
                          System.out.println( " ----------" );
                      }
                  System.out.println( "You rolled a total of " + ( die1 + die2) + "." );
                  attempts += 1;
                  Thread.sleep(500);
              } while ( die1 != die2 );
              
              if ( attempts > 1 )
                  System.out.println( "It required " + attempts + " attempts to roll doubles." );
              else 
                  System.out.println( "You rolled doubles in one try!" );
          }
      }
    

Picture of the output

Assignment 71