Nested Loops
A) Write a public static Java method named "nestedLoopsPartA" that uses a maximum
of three 'for' loops (no 'while', 'do-while', or 'if' statements) to produce the
following output exactly as shown:

     1  2  3  4  5  6  7  8  9  
        2  3  4  5  6  7  8  9  
           3  4  5  6  7  8  9  
              4  5  6  7  8  9  
                 5  6  7  8  9  
                    6  7  8  9  
                       7  8  9  
                          8  9  
                             9


B) Write a public static Java method named "nestedLoopsPartB" that uses a maximum
of three 'for' loops (no 'while', 'do-while', or 'if' statements) to produce the
following output exactly as shown:

                 9  
              9  8  7  
           9  8  7  6  5  
        9  8  7  6  5  4  3  
     9  8  7  6  5  4  3  2  1  


C) Use exactly two (nested) 'for' loops (and no other loops or 'if' statements) to
complete the public static Java method "nestedLoopsPartC" below to produce the
following output exactly as shown below.  Do not use any additional Lists or
Collections or modify the existing ArrayList of names in any way.

     Freddy    Sam       Joe       Julia     
     Kate      Pam       Sean      Jennifer  
     Margaret  Bobby     Jack      Nicole    

    public static void nestedLoopsPartC()
    {
        ArrayList<String> names = new ArrayList<String>();

        names.add("Freddy");
        names.add("Sam");
        names.add("Joe");
        names.add("Julia");
        names.add("Kate");
        names.add("Pam");
        names.add("Sean");
        names.add("Jennifer");
        names.add("Margaret");
        names.add("Bobby");
        names.add("Jack");
        names.add("Nicole");

        // [Your Code Goes Here]
    }


When writing the code for the three methods above, you are not permitted to
use any variables other than the counter variables needed to create an iterate
through your 'for' loops.  That is, the lines that print cannot reference any
variables other than the ones being used to execute your 'for' loops.

You should put all three of the above methods into a single file named
"NestedLoops.java".  You may find it helpful to create a 'main' method in
that file from which you can call and test your methods as you write them.


Advanced Option
For the "nestedLoopsPartC" method, in addition to displaying the
names as shown above, use exactly two nested 'for' loops (and no
other loops or 'if' statements) to display the names in columns,
rather than in rows, as shown below.  Your new code should not
modify the "names" ArrayList in any way.

     Freddy    Julia     Sean      Bobby
     Sam       Kate      Jennifer  Jack
     Joe       Pam       Margaret  Nicole