Results 1 to 2 of 2
  1. #1
    viperkevin is offline Member
    Join Date
    Nov 2012
    Rep Power

    Question Re-enter information question

    Hi guys,

    I'm using BlueJ, doing a small project for College.
    The project involves getting the user to enter information, do some calculations inside Java and showing the results a number of ways.

    My problem is this:
    How do I code it so that incorrect information needs to be reentered?

    For example- If the user enters a grade of 110, it must be between 0-100 so how do I make it go back to reentering?
    (Awkward wording )

    Here's my current code:

    System.out.print("Critical Thinking grade: ");
    if(opGrade<0 || opGrade >100)
    System.out.println("Please reenter the number");
    System.out.print("Critical Thinking grade: ");
    Using this way works, except if the wrong number is entered again, it just skips to the next question.


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

Similar Threads

  1. PC information question
    By roofninja in forum New To Java
    Replies: 7
    Last Post: 09-11-2012, 04:56 PM
  2. Replies: 5
    Last Post: 04-27-2011, 10:14 PM
  3. How Enter key act like TAB?
    By mine0926 in forum New To Java
    Replies: 2
    Last Post: 06-03-2010, 07:44 AM
  4. Enter
    By Arnold in forum New To Java
    Replies: 8
    Last Post: 10-18-2009, 10:17 AM
  5. enter key in swt
    By ashin in forum SWT / JFace
    Replies: 0
    Last Post: 07-17-2009, 10:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts