Assignment #40

Code

/// Name: Jonathan Stine
/// Period: 5
/// Program Name: Modulus Animation 
/// File Name: ModulusAnimation.java
/// Date Finished: 1/19/16
    
    
    public class ModulusAnimation {
    
    	public static void main( String[] args ) throws Exception {
    		
    		int repeats = 5;
    		int steps_per_second = 5;
    
    		for ( int i=0; i<40 ; i++ ) {
    			if ( i%10 == 0 )
    				System.out.print("M       \r");
    			else if ( i%10 == 1 )
    				System.out.print("OM      \r");
    			else if ( i%10 == 2 )
    				System.out.print("OOM     \r");
    			else if ( i%10 == 3 )
    				System.out.print("BOOM    \r");
    			else if ( i%10 == 4 )
    				System.out.print(" BOOM  \r");
    			else if ( i%10 == 5 )
    				System.out.print("  BOOM \r");
    			else if ( i%10 == 6 )
    				System.out.print("   BOOM\r");
    			else if ( i%10 == 7 )
    				System.out.print("    BOO\r");
    			else if ( i%10 == 8 )
    				System.out.print("     BO\r");
    			else if ( i%10 == 9 )
    				System.out.print("      B\r");
    			else if ( i%10 == 10 )
    				System.out.print("            \r");
                
                                                                                                                        
                                    
    			Thread.sleep(1000/steps_per_second);
    		}
    		
    	}
    }
    
 
    

Code Output