Give an assignment until it reaches a number, after that another assignment, and so on
<p>I want to make an algorithm that will print out for exemple, "that is ok" until the number 0.25. And after that it says "warning", so when it reaches 0.3 it warns one person (one variable, let's call it person A); When the value raises up to 0.4 it warns two people (person A and person B); And finally, when it reaches 0.5 it warns three people (person A, person B, person C).</p>

<p>So, I don't know which variables to use, but going one step at a time, I came up with the following;</p>

<pre><code>import java.util.Scanner;

public class apple {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner mc = new Scanner(System.in);
        double ind;
        ind = mc.nextDouble();

        switch (ind){
        case 0.25:
            System.out.println("Ok");
            break;
        case 0.3:
            System.out.println("Warning");
            break;
        case 0.4:
            System.out.println("danger");
        }
    }

}
</code></pre>

<p>now, i know switch is only usable to int variables. But I guess my logic was at the frakking least, in the right place XD.
Help anyone?</p>

<hr>

<p>So here, is What I came up with, but now I got a new problem, I want that the value start from 0 and move up to 0.25 without anyone typing, i guess just like "for". I donno, maybe i'm too noob to make sense.</p>

<pre><code>public static void main(String[] args) {

Scanner mc = new Scanner(System.in);
    System.out.println("Level of radiation: ");
    double ind = mc.nextDouble();
    if (ind &lt;= 0.25) {
           System.out.println("Ok");
        } else if (ind &lt;= 0.3) {
           System.out.println("Warning");
        } else if (ind &lt;= 0.4) {
           System.out.println("danger");
        }
}
</code></pre>

<p>}</p>
