Explore BrainMass
Share

Explore BrainMass

    Counter-Controlled while loop

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Need help trying to figure out counter controlled while loop. I need to write a counter-controlled while loop that uses the loop control variable to take on the values 0 and 10. How do I initialize the loop control variable before the program enters the loop?
    In the boy of the loop, I need to multiply the value of the loop control variable by 10 and by 100, then I need to change the value of the loop control variable in the body of the loop.

    String head1 = "Number: ";
    String head2 = "Multiplied by 10: ";
    String head3 = "Multiplied by 100: ";
    int numberCounter; // Numbers 0 through 10.
    int byTen; // Stores the number multiplied by 10.
    int byHundred; // Stores the number multiplied by 100.
    final int NUM_LOOPS = 10; // Constant used to control loop.

    // This is the work done in the housekeeping() method
    System.out.println("0 through 10 multiplied by 10 and by 100" + "n");

    // This is the work done in the detailLoop() method
    // Initialize loop control variable.
    // Write your counter controlled while loop here
    // Multiply by 10
    // Multiply by 100

    © BrainMass Inc. brainmass.com October 10, 2019, 5:00 am ad1c9bdddf
    https://brainmass.com/computer-science/control-structures/counter-controlled-while-loop-487870

    Solution Preview

    (--Please note that my work should only be used as a guidance and not be ...

    Solution Summary

    Counter-controlled while loops are examined.

    $2.19