Java conditional statement/ initializing variable
<p>Currently this is my code, and I need to display " Please enter a valid choice" when the user don't pick A,B,C,D,E or F as their choices. The problem is if I put the statement " Please enter a valid...." on the "else" conditional, Java would ask me to initialized the variable ActivityFactor as there will not be one if the user don't select the correct choice. Anyone know how I can fix this? Or any idea how I should code a program to do such?</p>

<pre><code>if((inGender.equalsIgnoreCase("M") ||(inGender.equalsIgnoreCase ("F"))) &amp;&amp; inActivity.equalsIgnoreCase("A"))
            ActivityFactor = 1.0;

        else if ((inGender.equalsIgnoreCase("M") ||(inGender.equalsIgnoreCase ("F"))) &amp;&amp; inActivity.equalsIgnoreCase("B"))
        ActivityFactor = 1.3;

        else if (inGender.equalsIgnoreCase("M") &amp;&amp; inActivity.equalsIgnoreCase("C"))
        ActivityFactor = 1.6;
        else if (inGender.equalsIgnoreCase("F") &amp;&amp; inActivity.equalsIgnoreCase("C"))
        ActivityFactor = 1.5;
        else if (inGender.equalsIgnoreCase("M") &amp;&amp; inActivity.equalsIgnoreCase("D"))
        ActivityFactor = 1.7;
        else if (inGender.equalsIgnoreCase("F") &amp;&amp; inActivity.equalsIgnoreCase("D"))
        ActivityFactor = 1.6;
        else if (inGender.equalsIgnoreCase("M") &amp;&amp; inActivity.equalsIgnoreCase("E"))
        ActivityFactor = 2.1;
        else if (inGender.equalsIgnoreCase("F") &amp;&amp; inActivity.equalsIgnoreCase("E"))
        ActivityFactor = 1.9;
        else if (inGender.equalsIgnoreCase("M") &amp;&amp; inActivity.equalsIgnoreCase("F"))
        ActivityFactor = 2.4;
        else if (inGender.equalsIgnoreCase("F") &amp;&amp; inActivity.equalsIgnoreCase("F"))
        ActivityFactor = 2.2;
        else
        {
       ActivityFactor = -1;

    }

    //After
    if(ActivityFactor != -1){
     tdee = (nBMR * ActivityFactor);
     System.out.println(tdee);}
    else
   { System.out.println("Please enter a valid choice");
    }
</code></pre>
