title: Negative number end the program using for loop?
body: <p>Hi guys I don't quite understand how to use a for loops as we just started learning them today. I have to add a for loop to a program that we made earlier. It has to keep asking for the dogs age until the user inputs a negative number. Here is what I have: </p>
  
  <pre><code>import java.util.Scanner;
  
  public class DogYears
  {
      public static void main(String [] args)
      {
          Scanner scan = new Scanner(System.in);
          System.out.print("Enter your dog's age in human years: ");
          int age = scan.nextInt();
  
          int dogAge = age * 7;
          System.out.println("Your dog is " + age + " in human years and "
              + dogAge + " in dog years!");
  
          if (dogAge &gt;= 150)
              System.out.println("Likely story");
          else if (dogAge &gt;= 80 &amp;&amp; dogAge &lt; 150)
              System.out.println("Hello grand-dog");
          else if (dogAge &gt;= 40 &amp;&amp; dogAge &lt; 80)
              System.out.println("Boring!");
          else if (dogAge &gt;= 20 &amp;&amp; dogAge &lt; 40)
              System.out.println("Get a job!");
          else if (dogAge &lt; 20)
              System.out.println("Just a pup!");
      }
  }
  </code></pre>