Question: I'm doing a grade average script for my class and I can't figure how to get my cross check section to repeat until I have a valid value (Code is listed below). When ran, it allows me to make the correction if the original input is invalid but does this only once. How can I loop until I get a proper response? Thanks in advance!

```
  if (grade1 >= 0 && grade1 <= 100)
     System.out.println("First grade valid.\n");
  else
     {
        System.out.println("Grade invalid.  Re-enter first grade:");
        grade1 = kb.nextDouble();
     }

```

Answer: 
consider

```
grade = -1;
System.out.println("Enter a grade:\n");
grade1 = kb.nextDouble();
if (grade1 >= 0 && grade1 <= 100)
{
    System.out.println("First grade valid.\n");
}
else
{
    while (grade1 < 0 || grade1 > 100)
    {
        System.out.println("Grade invalid.  Re-enter first grade:");
        grade1 = kb.nextDouble();
    }
}

```
Chara, as the method executed originally, I setup it up so user plugs in their inputs and cross checks the validity after they've been entered (see first excerpt below). Figured it would be best to save the space if I could just actively cross check upon initial input (see second excerpt below). Lew Bloch, I understand what you are getting at and this was a slight oversight on my part. I will do better in my responses from now on.

// Cross Check

```
  if (grade1 >= 0 && grade1 <= 100)
     System.out.println("First grade valid.\n");
  else
     {
        System.out.println("Grade invalid.  Re-enter first grade:");
        grade1 = kb.nextDouble();
     }

```

// Grade entry

```
  grade1 = kb.nextDouble();
  while (grade1 < 0 || grade1 > 100)
  {
     System.out.println("Entered grade is invalid.  Re-enter grade:");
     grade1 = kb.nextDouble();
  }

```