picking and choosing variables to activate and a user input method to do so
<p>I have 14 variables that I have defined, but only want these to apply to a logarithm I have developed when explicitly called on via User Input. The logarithm I've made is for a tabletop RPG group of mine for character creation and uses "elemental alignments" in order to influence statistical data. The most a person can use are 5 of these at any time but no less than one.</p>

<pre><code>double elemFire
double elemIce
double elemWater
double elemWind
double elemEarth
double elemPoison
double elemGravity
double elemShadow
double elemLight
double elemElec
double elemHoly
double elemAnti
double elemVoid
double elemTime
</code></pre>

<p>How would I call these specific variables using user input and ensure that a minimum of one and a maximum of 5 can be used at any given time?</p>

<p>The logarithm for calculations is absolutely massive as is and I do not want to have to make 14 more copies of that massive block of code. The biggest ambition is to cause the 1-5 variables called on to add a cumulative effect to the core stats for easier display.</p>

<p>This is the logarithm.</p>

<pre><code>Scanner sin = new Scanner(System.in);
      System.out.print("What year were you born? :");

      yearBorn = sin.nextDouble();
      logHPCalc = 2.0 / 16.0;
      yourHP = yearBorn * logHPCalc;
      yourMP = yourHP / 2.0;
      yourNP = yourMP / 3.0;
          yourPSI = yourNP + yourMP / 32.0;
            logATK = yearBorn / 60.0;
            logDEF = yearBorn / 120.0;
            logMAG = yearBorn / 60.0;
            logSPR = yearBorn / 120.0;
            logSPD = yearBorn / 60.0;
            logLCK = yearBorn / 120.0;
            logEATK = yearBorn / 60.0;
            logEDEF = yearBorn / 120.0;
                statATK = yourHP / 2.0 + logATK;
                statDEF = yourHP / 3.0 + logDEF;
                statSPR = yourMP / 2.0 + logSPR;
                statMAG = yourMP / 3.0 + logMAG;
                statSPD = yourNP / 2.0 + logSPD;
                statLCK = yourNP / 3.0 + logLCK;
                statEATK = yourPSI / 2.0 + logEATK;
                statEDEF = yourPSI / 3.0 + logEDEF;

      System.out.print("What year is it? :");

                yearNow = sin.nextDouble();
                logHPCalcNow = logHPCalc * yearNow + 2.0 * 32.0;
                yourHPNow = yearBorn * logHPCalcNow;
            yourMPNow = yourHPNow / 2.0;
                yourNPNow = yourMPNow / 3.0;
                yourPSINow = yourMPNow + yourNPNow / 32.0;
                    logATKNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0;
                    logDEFNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0;
                    logMAGNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0;
                    logSPRNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0;
                    logSPDNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0;
                    logLCKNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0;
                    logEATKNow = yearBorn / 60.0 * yearNow * 2.0 * 32.0;
                    logEDEFNow = yearBorn / 120.0 * yearNow * 2.0 * 32.0;
                        statATKNow = yourHPNow / 2.0 + logATKNow;
                        statDEFNow = yourHPNow / 3.0 + logDEFNow;
                        statSPRNow = yourMPNow / 2.0 + logSPRNow;
                        statMAGNow = yourMPNow / 3.0 + logMAGNow;
                        statSPDNow = yourNPNow / 2.0 + logSPDNow;
                        statLCKNow = yourNPNow / 3.0 + logLCKNow;
                        statEATKNow = yourPSINow / 200.0 + logEATKNow;
                        statEDEFNow = yourPSINow / 300.0 + logEDEFNow;

        nonHPBase    = 200;
        nonATKBase   = 5;
        nonDEFBase   = 5;
        nonSPDBase   = 4;
        nonLCKBase   = 2;
        nonHPGain    = nonHPBase * nonDEFBase - 10 + yearNow;
        nonATKGain   = nonHPBase * nonATKBase / 25 + yearNow / 200;
        nonDEFGain   = nonHPBase * nonATKGain / 110 + yearNow / 200;
        nonATKDEFSum = nonATKGain + nonDEFGain;
        nonSPDGain   = nonHPBase * nonATKDEFSum / 1000 + yearNow / 200;
        nonSPDSum    = nonHPBase * nonATKDEFSum / 2000;
        nonLCKGain   = nonHPBase * nonSPDSum / 400 + yearNow / 200;


usrTRANS = 4;

        transHP = yearBorn * logHPCalc * usrTRANS;
    transMP = yourHP / 2.0 * usrTRANS;
    transNP = yourMP / 3.0 * usrTRANS;
        transPSI = yourNP + yourMP / 32.0 * usrTRANS;
            translogATK = yearBorn / 60.0 * usrTRANS;
            translogDEF = yearBorn / 120.0 * usrTRANS;
            translogMAG = yearBorn / 60.0 * usrTRANS;
            translogSPR = yearBorn / 120.0 * usrTRANS;
            translogSPD = yearBorn / 60.0 * usrTRANS;
            translogLCK = yearBorn / 120.0 * usrTRANS;
            translogEATK = yearBorn / 60.0 * usrTRANS;
            translogEDEF = yearBorn / 120.0 * usrTRANS;
                transstatATK = yourHP / 2.0 + logATK * usrTRANS;
                transstatDEF = yourHP / 3.0 + logDEF * usrTRANS;
                transstatSPR = yourMP / 2.0 + logSPR * usrTRANS;
                transstatMAG = yourMP / 3.0 + logMAG * usrTRANS;
                transstatSPD = yourNP / 2.0 + logSPD * usrTRANS;
                transstatLCK = yourNP / 3.0 + logLCK * usrTRANS;
                transstatEATK = yourPSI / 2.0 + logEATK * usrTRANS;
                transstatEDEF = yourPSI / 3.0 + logEDEF * usrTRANS;
                translogHPCalcNow = logHPCalc * yearNow + 2.0 * 32.0 * usrTRANS;
                transHPNow = yearBorn * logHPCalcNow * usrTRANS;
            transMPNow = yourHPNow / 2.0 * usrTRANS;
                transNPNow = yourMPNow / 3.0 * usrTRANS;
                transPSINow = yourMPNow + yourNPNow / 32.0 * usrTRANS;
                    translogATKNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogDEFNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogMAGNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogSPRNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogSPDNow = yearBorn / 60.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogLCKNow = yearBorn / 120.0 * yearNow + 2.0 * 32.0 * usrTRANS;
                    translogEATKNow = yearBorn / 60.0 * yearNow * 2.0 * 32.0 * usrTRANS;
                    translogEDEFNow = yearBorn / 120.0 * yearNow * 2.0 * 32.0 * usrTRANS;
                        transstatATKNow = yourHPNow / 2.0 + logATKNow * usrTRANS;
                        transstatDEFNow = yourHPNow / 3.0 + logDEFNow * usrTRANS;
                        transstatSPRNow = yourMPNow / 2.0 + logSPRNow * usrTRANS;
                        transstatMAGNow = yourMPNow / 3.0 + logMAGNow * usrTRANS;
                        transstatSPDNow = yourNPNow / 2.0 + logSPDNow * usrTRANS;
                        transstatLCKNow = yourNPNow / 3.0 + logLCKNow * usrTRANS;
                        transstatEATKNow = yourPSINow / 200.0 + logEATKNow * usrTRANS;
                        transstatEDEFNow = yourPSINow / 300.0 + logEDEFNow * usrTRANS;
</code></pre>

<p>I want these 14 variables to affect this, but only when called on, and only a minimum of 1 and a maximum of 5. Code optimization help is optional but would be GREATLY appreciated.</p>

<p>==============EDIT FOR A COMMENT=============</p>

<p>now uhh, Randy? It doesn't like doing math.
This is how the element variables are set up:</p>

<pre><code>elemFire     = 10 * 2 * 2 / 32
elemIce      = 10 * 2 * 3 / 32
elemWater    = 10 * 2 * 4 / 32
elemWind     = 10 * 2 * 5 / 32
elemEarth    = 10 * 2 * 6 / 32
elemPoison   = 10 * 2 * 7 / 32
elemGravity  = 10 * 2 * 8 / 32
elemShadow   = 10 * 2 * 9 / 32
elemLight    = 10 * 2 * 10 / 32
elemElec     = 10 * 2 * 11 / 32
elemHoly     = 10 * 2 * 12 / 32
elemAnti     = 10 * 2 * 13 / 32
elemVoid     = 10 * 2 * 14 / 32
elemTime     = 10 * 2 * 15 / 32
</code></pre>

<p>I need this thing to be able to do math. otherwise if i can wrap my head around your "add things to the map" instructions and the</p>

<pre><code>for (String element : elements) {
yourHp += elementMap.get(element);
</code></pre>

<p>thingamajig it'll be perfect if i can inject this into my big-arsed class.</p>

<p>---------------EDIT 7/15 ---------------------</p>

<p>Rob, what.. exactly is the ultimate output variable in that code you wrote out, because either I'm not understanding which one it is or i can't find it.</p>

<p>I'm going to pastebin my code with what you wrote inside it. It is commented. It won't run, because i either do not know where the ultimate output variable is in your element selection array is, or it simply does not exist.</p>

<p>where I have TRIED to put it to make it work is clearly marked.</p>

<p><a href="http://pastebin.com/SFVRbs08" rel="nofollow">http://pastebin.com/SFVRbs08</a></p>

<p>apologies for tab lacking, due to pastebin.</p>
