Assignment = flicker phrase

Code

  /// Name: Sam Wilson
  /// Period: 6
  /// Program Name: flicker phrase
  /// File Name: flicker.java
  /// Date Finished: 3/5/16
 
  


    import java.util.Random;
    
    public class flicker
    {
    	public static void main( String[] args ) throws Exception
    	{
    		Random rng = new Random();
    		int r;
    		
    		for ( int i=0; i < 100000; i++ )
    		{
    			r = 1 + rng.nextInt(5);
    			switch (r)
    			{
    				case 1: first();
    					break;
    				case 2: second();
    					break;
    				case 3: third();
    					break;
    				case 4: fourth();
    					break;
    				case 5: fifth();
    					break;
    			}
    			Thread.sleep(10);
    		}
    
    		System.out.println("I pledge allegiance to the flag.");
    		
    	}
    
    	public static void first()
    	{
    		System.out.print("I                               \r");
    	}
    
    	public static void second()
    	{
    		System.out.print("  pledge                        \r");
    	}
    
    	public static void third()
    	{
    		System.out.print("         allegiance             \r");
    	}
    
    	public static void fourth()
    	{
    		System.out.print("                    to the      \r");
    	}
    
    	public static void fifth()
    	{
    		System.out.print("                           flag.\r");
    	}
    }





    

Picture of the output

Assignment 31