If Statement #40 (Make your own loading bar)

Code

/// Name: Amir Salehi
/// Period: 7
/// Program Name: Modulus Animation
/// File Name: ModulusAnimation.java
/// Date Finished: 10/20/2015

public class ModulusAnimation {

    public static void main(String[] args) throws Exception {

        int repeats = 5, framesPerSecond = 5, framesPerCycle = 14;

        for (int i = 0; i < framesPerCycle * repeats + 1; i++) {
            if (i % framesPerCycle == 0) {
                System.out.print(" ..ooOoo..     \r");
            } else if (i % framesPerCycle == 1) {
                System.out.print("  ..ooOoo..    \r");
            } else if (i % framesPerCycle == 2) {
                System.out.print("   ..ooOoo..   \r");
            } else if (i % framesPerCycle == 3) {
                System.out.print("    ..ooOoo..  \r");
            } else if (i % framesPerCycle == 4) {
                System.out.print("     ..ooOoo.. \r");
            } else if (i % framesPerCycle == 5) {
                System.out.print(" .    ..ooOoo. \r");
            } else if (i % framesPerCycle == 7) {
                System.out.print(" ..    ..ooOoo \r");
            } else if (i % framesPerCycle == 8) {
                System.out.print(" o..    ..ooOo \r");
            } else if (i % framesPerCycle == 9) {
                System.out.print(" oo..    ..ooO \r");
            } else if (i % framesPerCycle == 10) {
                System.out.print(" Ooo..    ..oo \r");
            } else if (i % framesPerCycle == 11) {
                System.out.print(" oOoo..    ..o \r");
            } else if (i % framesPerCycle == 12) {
                System.out.print(" ooOoo..    .. \r");
            } else if (i % framesPerCycle == 13) {
                System.out.print(" .ooOoo..    . \r");
            }
            Thread.sleep(1000 / framesPerSecond);

    }

}
}

    
    

Picture of the output

Assignment 7

Back to Homepage

Easter Egg