17 if (data <= 1.5) You cannot compare integer with floating point number. You will sometimes get things like 1.3 != 1.3. Either instantiate BigDouble or whatever java class having methods to deal with floating point comparison, or set some threshold of comparison. Ie target is equal +- .5. 22 } 23 24 JOptionPane.showMessageDialog(null, "The sum is " + sum); 25 }{ 26 JOptionPane.showMessageDialog(null, "count is" + count); 27 } 28 } 29 30 I don't have eclipse open but that definately looks multiple syntax errors. Check your braces, make sure they line up. 20 for (count = 1; count >= 10.25; count++) {}; Again comparison int and float = bad. The logic seems off. Loop will run 10 times unless comparison goes awry. 5 publicclass SentinelValue2 { public class Foo{...} You are close... Sum = 0; Count = 0; InputCount = 0; For each user input InputCount++ temp = BigDouble(input) or the jazz I talked about earlier. if temp > 1.5 count ++ if temp > 10.5 Sum + temp Print Sum Print Count Good luck.
you also need to clean up the brackets as the above poster mentioned. I find that indenting my code helps for readability. You can easily see what is happening in each chunk of code. my ending algorithm would probably be something very similar to this:
Wow. +like for making me put my geek hat on to understand what you wrote. That poor geek hat was getting pretty dusty around these modern internets.