Looping practice 1        name:

 

/**

 * Looping practice

 

Output:

 

 */

public class LoopPrac1Bugs {

    public static void main(String[] args) {

        boolean control = true;

        int bugCount = 0;

        final int MAX_COUNT = 5;

        while(control){

            if(bugCount > MAX_COUNT){

                control = false;

            }

            bugCount++;

        } // end while

        System.out.println("BugCount = " + bugCount);

        System.out.println("Control = " + control);

    } // end main

} // end class

 

 

Looping practice 2

 

Output:

 

/**

 * Looping practice 2

 * @author sylvia

 */

public class LoopPrac1Bugs2 {

    public static void main(String[] args) {

        boolean control = true;

        int spiderCount = 100;

        while(spiderCount > 0){

            spiderCount = spiderCount - (27 % 11);

            System.out.println(spiderCount);

        } // end while

        System.out.println("Spider Count = " + spiderCount);

    } // end main

} // end class