Switch statement vs Enum variable : <p>I have an enum with the following scheme : </p>

<pre><code>public enum Enum{
    A,
    B,
    C,
    D
    //...
}
</code></pre>

<p>In another class, I compute a <code>score</code> based on this enum. </p>

<p><strong>Which approach I should use and why ?</strong> </p>

<p><strong>Solution 1:</strong></p>

<p><em>I use a switch statement</em> : </p>

<pre><code>public int score(Enum value)
{
    switch(value){
        case Enum.A:
            this.score *= 25;
            break;
        case Enum.B: 
            this.score *= 7;
            break;
        case Enum.C:
            this.score *= 2;
            break;
        //...
    }
    return this.score;
}
</code></pre>

<p><strong>Solution 2:</strong></p>

<p><em>I add a variable to my Enum</em> :</p>

<pre><code>public enum Enum{
    A(25),
    B(7),
    C(2),
    D(16),
    //...
    Z(100);

    private final int scoreMultiplier;

    Enum(int scoreMultiplier){
        this.scoreMultiplier = scoreMultiplier;
    }

    public int getScoreMultiplier(){return scoreMultiplier;}
}
</code></pre>

<p>And then, my score method : </p>

<pre><code>public int score(Enum value)
{
    this.score *= value.getScoreMultiplier();
    return this.score;
}
</code></pre>
