-1

I've been writing a java code where it has to randomly generate 5 maneuvers per dive for a total of 10 dives from two different pools (random formations and block sequences). Right now i'm trying to just generate 5 from each pool for 10 round, and i have made two for-loops inside a while-loop. Without the while-loop the program executes successfully. However when i implement the while-loop it completely disregards the body of the while-loop and terminates (checked via debugging).

    import java.util.Random; // import Randomizer
    public class Skydiving
    {
        public static void main(String[]args) 
        {
            Random rand = new Random(); // Randomizer initialized
            int i = 0; // counter
            while (i > 10) //while loop for the 10 rounds
            {
                System.out.println("First Jump:");
                for (int jumps = 0; jumps < 5; jumps++) //for loop for sequence randomizer
                {
                int SequenceNumber = rand.nextInt(16)+1; // random number between 1 and 22 for Sequence number
                int SequenceLetter = SequenceNumber;
                switch (SequenceLetter)
                {
                case 1: System.out.println("A,Unipod");continue;
                case 2: System.out.println("B, Stairstep Diamond");continue; 
                case 3: System.out.println("C, Murhpy Flake");continue;
                case 4: System.out.println("D, Yuan");continue;
                case 5: System.out.println("E, Meeker");continue;
                case 6: System.out.println("F, Open Accordian");continue;
                case 7: System.out.println("G, Cataccord");continue;
                case 8: System.out.println("H, Bow");continue;
                case 9: System.out.println("J, Donut");continue;
                case 10: System.out.println("K, Hook");continue;
                case 11: System.out.println("L, Adder");continue;
                case 12: System.out.println("M, Star");continue;
                case 13: System.out.println("N, Crank");continue;
                case 14: System.out.println("O, Satellite");continue;
                case 15: System.out.println("P, Sideboy");continue;
                case 16: System.out.println("Q, Phalanx");continue;

            } //end of first switch
        } //end of first for loop
        System.out.println();
        System.out.println("Second Jump:");
        for (int jumps = 0; jumps < 5; jumps++) // for-loop for formation randomizer
        {
            int FormationNumber = rand.nextInt(22)+1; // random number between 1 and 16 for Formation a-q excluding letter i
            int FormationName = FormationNumber;
            switch (FormationName) 
            {
                case 1:System.out.println("1: Snowflake; Inter; Snowflake");break;
                case 2: System.out.println("2: Sidebody; Inter; Side Flake Donut");continue; 
                case 3: System.out.println("3: Side Flake Opal; Inter; Turf");break;
                case 4: System.out.println("4: Monopod; Inter; Monopod");break;
                case 5: System.out.println("5: Opal; Inter; Opal");break;
                case 6: System.out.println("6: Stardian; Inter; Stardian");break;
                case 7: System.out.println("7: Sidebuddies; Inter; Sidebuddies");break;
                case 8: System.out.println("8: Canadian Tee; Inter; Canadian Tee");break;
                case 9: System.out.println("9: Cat+Accordian; Inter; Cat+Accordian");break;
                case 10: System.out.println("10; Daimond; Inter; Bunyip");break;
                case 11: System.out.println("11: Photon; Inter; Photon");break;
                case 12: System.out.println("12: Bundy; Inter; Bundy");break;
                case 13: System.out.println("13: Offset; Inter; Spinner");break;
                case 14: System.out.println("14: Bipole; inter; Bipole");break;
                case 15: System.out.println("15: Caterpilar; Inter; Caterpilar");break;
                case 16: System.out.println("16: Compressed; Inter; Box");break;
                case 17: System.out.println("17: Danish Tee; Inter; Murphy");break;
                case 18: System.out.println("18: ircon; Inter; Zircon");break;
                case 19: System.out.println("19: Ritz; Inter; Icepick");break;
                case 20: System.out.println("20: Piver; Inter; Viper");break;
                case 21: System.out.println("21: Zigzag; Inter; Marquis");break;
                case 22: System.out.println("22: Tee; Inter; Chinese Tee");break;
            } //end of second switch
        }// end of second for loop
      i++; // while counter increase
    } //end of while loop  
} // end of main
}//end of body

My compiler (eclipse) isn't showing any errors, so i'm guessing it is a logical error.It there something I'm missing that's stopping the while-loop or is this the wrong way of implementing this concept?

1 Answers1

1

Well, this won't work, right?

        int i = 0; // counter
        while (i > 10) //while loop for the 10 rounds

Obviously i is not greater than 10. So the loop won't even run once.

Kon
  • 10,702
  • 6
  • 41
  • 58