CS1 Standard Demo Page

The following text was written to the standard output stream when the Roller.java program was executed from Netbeans.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package chanceapps;

import chance.Die;

/**
 *
 * @author ecuevas
 */
public class Roller {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //CREATE A STANDARD DIE AND ROLL IT 5 TIMES 
        createAndRollStandardDieFiveTimes();
        //CREATE A TWENTY SIDED DIE AND ROLL IT 5 TIMES
        createAndRollTwentySidedDieFiveTimes();
        //CREATE A STANDARD DIE AND ROLL IT 20 TIMES
        createAndRollStandardDie(20);
        //CREATE A STANDARD DIE AND ROLL IT 30 TIMES
        createAndRollStandardDie(30);
        //CREATE A NINE SIDED DIE AND ROLL IT 20 TIMES
        createAndRollNineSidedDie(20);
        //CREATE A NINE SIDED DIE AND ROLL IT 30 TIMES
        createAndRollNineSidedDie(30);
        System.out.println("Ten times, roll a twelve sided die for a 1.");
        for (int i = 1; i <= 10; i++) {
              createAndRollStandardDieFor1();
        }

        //TEN TIMES, CREATE A STANDARD DIE AND ROLL IT UNTIL YOU GET A 1 
        System.out.println("Ten times, roll a twelve sided die for a 1.");
        for (int i = 1; i <= 10; i++); {
            createAndRollStandardDieFor1();
    }
        
        
    }

    private static void createAndRollStandardDieFiveTimes() {
        System.out.println("Roll a standard die 5 times...");
        Die die = new Die();
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        
        System.out.println();
    }

    private static void createAndRollTwentySidedDieFiveTimes() {
        System.out.println("Roll a twenty sided die 5 times...");
        Die die = new Die(20);
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll();
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
        die.roll(); 
        System.out.print(die.top() + " ");
       
        
    }

    private static void createAndRollStandardDie(int nrOfTimes) {
        System.out.println("Roll a standard die " + nrOfTimes + " times ...");
        Die lucky = new Die();
        
        int i = 1;
        while (lucky.top() != 1) {
            lucky.roll();
            System.out.println();
            i = 1 + 1;
            
        }
        System.out.println();
    }

          private static void createAndRollNineSidedDie(int nrOfTimes) {
          System.out.println("Roll a nine sided die " + nrOfTimes + " times...");
          Die lucky = new Die(9);
          
          int i = 1;
          while(i <= nrOfTimes){
              lucky.roll();
              System.out.print(lucky.top() + " ");
              i++;
          }       
          System.out.println();
      
     }
 
     private static void createAndRollStandardDieFor1() {
         
         Die lucky = new Die();
         lucky.roll();
         System.out.print(lucky.top() + " ");
         
         int i = 1;
         while( lucky.top() != 1){
             lucky.roll();
             System.out.print(lucky.top() + " ");
             i++;
         }       
         System.out.println();
     }
 
     private static void createAndRollTwelveSidedDieFor1() {
         
         Die lucky = new Die(20);
         
         int i = 1;
         while(lucky.top() != 1){
             lucky.roll();
             System.out.print(lucky.top() + " ");
             i++;
         }       
         System.out.println();
     }
 
 }