Need help writing a program that finds the highest and second highest number is a series
<p>The program is designed for the user to enter a series of numbers until the user enters the sentinel which i set to the value of 0. After the user enters the sentinel the program is supposed to print the highest number and the second highest number in that list. The trouble I'm having is where I expect the second highest number to be it prints 0 instead. <br/></p>

<p>Is there a more elegant way of solving this problem by using the ?: operator? Is it possible? </p>

<pre><code>import acm.program.*;

public class LargestAndSecondLargest extends ConsoleProgram {

    public void run() {

        int a = 0;
        int b = 0; 

        while (true) {

            int value = readInt(" ?: ");

            if (value == SENTINEL) break;

            if (value &gt; a) {
                a = value;   
            }
            else if (value &gt; b) {
                b = value;
            }
        }

        println("the largest value is " + a);
        println("the second largest number is"  + b);
    }

    private static final int SENTINEL = 0; 
}
</code></pre>
