Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: coding a sentinel-controlled do/while loop within a for

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post

    Question coding a sentinel-controlled do/while loop within a for

    sentinel-controlled do/while loop within a for statement

    for(int c = 1; c <= teamName; c++)
    {
    do
    {
    System.out.printf("\nWhat is the name of team no. %d?", c );
    team = input.nextLine();

    System.out.printf("\nYou entered %s. Is this correct? Enter 'Y' or 'N':", team );
    cont1 = input.next().charAt(0);
    input.nextLine();
    }
    while(Character.toUpperCase(cont1)=='N' );
    Last edited by Seananigans; March 5th, 2014 at 05:52 PM. Reason: SOLVED


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,446
    My Mood
    Mellow
    Thanks
    144
    Thanked 607 Times in 594 Posts

    Default Re: coding a sentinel-controlled do/while loop within a for

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    One of the purposes of a forum like this is to share what you've learned with others. Since you had a problem and found a solution either on your own or from another source, it may be helpful to someone else someday if you were to NOT delete the original question AND post the solution you've discovered. Otherwise, it's wasted space. Your choice.

Similar Threads

  1. [SOLVED] Java Coding: Assistance with a loop that calculates maximum, minimum, and average of 10 inputted numbers.
    By Knowledge_Feeds_The_Mind in forum What's Wrong With My Code?
    Replies: 20
    Last Post: February 27th, 2014, 10:11 PM
  2. [SOLVED] Need help with Sentinel Control Loop
    By Roku in forum Loops & Control Statements
    Replies: 1
    Last Post: March 21st, 2013, 06:52 AM
  3. Setting variable correctly in sentinel-controlled loop
    By exchaoordo in forum Loops & Control Statements
    Replies: 1
    Last Post: June 1st, 2012, 03:40 PM
  4. input controlled loop
    By pezbirdy in forum Loops & Control Statements
    Replies: 4
    Last Post: November 10th, 2011, 05:16 AM
  5. Help with counter controlled while loop please!
    By rockout341 in forum Loops & Control Statements
    Replies: 3
    Last Post: March 15th, 2011, 02:41 PM