Java; looking for lowest Int : <p>Hi I need help with finding the the lowest income.
Here is the link for the codeCheck </p>

<p><a href="http://www.codecheck.it/files/18030103413ucpa6f7ev1gbmexv0tlv2av3" rel="nofollow noreferrer">http://www.codecheck.it/files/18030103413ucpa6f7ev1gbmexv0tlv2av3</a></p>

<p>the code i have written is at the bottom. I Cannot figure out why its the output doesn't show. Thank you in advance. </p>

<p>Companies report net income every quarter of the year. Some quarters Amazon's net income per share is positive, and some quarters it is negative. (It is always small because Amazon reinvests any profits in the business.)</p>

<p>Write an application (A program that has a main methods) called AmazonNetIncome to read a collection of integers, each representing a positive, negative or 0 net income for the quarter for 100 shares of Amazon stock. The input will terminate when the user enters a non-integer.</p>

<p>Use this prompt: System.out.print("Enter net income or Q to quit: ");</p>

<p>Note: you will actually quit on any string that can not be converted  to an int.</p>

<p>Do the following:</p>

<pre><code>find and print the number of profitable years (net income greater than 0.)
find and print the lowest net income
find and print the average net income
</code></pre>

<p>Only print the numbers if at least 1 integer was entered. Otherwise print "No values entered"</p>

<p>You will read the inputs one at a time and do all the processing as you go. No Arrays for this</p>

<p>The outputs should be on separate lines and in this order</p>

<pre><code>number of profitable years
lowest net income
average net income
</code></pre>

<p>Do not initialize the minimum to 0 or some negative number. You can temporarily set it to 0 when you declare it but then initialize to the first input. You can use a boolean variable as a flag as discussed in the videos.</p>

<pre><code>import java.util.*;
public class AmazonNetIncome
{
   public static void main(String[]args)
   {

      Scanner in = new Scanner (System.in);
      System.out.print("Enter net income or Q to quit: ");
      double profit= 0;
      int count = 0;
      int count2 = 0;
      int smalled =0;

      double average = 0;
         if(in.hasNextInt())
         {
            while(in.hasNextInt())
            { 
               System.out.print("Enter net income or Q to quit: ");
               int num = in.nextInt();
                profit= profit + num;
                count2++;
                average = profit/count2;


               if(num &gt; 0)
               {
                  count++;
               }

               if (num &lt; smalled )
               {
                   smalled = num;

               }


            }

            System.out.println(count);
            System.out.println(smalled);
            System.out.println(average);
      }
      else
      {
         System.out.println("No values entered");
      }
   }
}
</code></pre>
