VB.net: How to add different multipliers together?

2019-09-07 02:24发布

问题:

I am creating an EXP multiplier and I do not know how to separate multipliers.

My Aim: My aim is to make it so that the multiplier from 'checkbox5.checked = true' will not multiply by the rest of checkboxes but just add its product. If 'checkbox1.checked = true' it will multiply the EXP, which is the input amount by 2. So if checkbox4 is checked, it will multiply the EXP by 1.5 again. So 2x1.5 = 3

However for checkbox5, which multiplier is x1.1, I do not want it to be multiplying the rest of the exp, which means 2x1.5x1.1 = 3.3 but rather adding it in separately, but still displaying the answer in one result which i mean is 2x1.5 + 1.1 = 4.1.

So it means if the input is '2' and checkbox 1,4 and 5 is checked then the answer will be 8.2 not 6.6.

But i do not know how to that, please help!

Here is my code:

Dim exp2 As Double
Dim exptotal As Double
Dim exp As Double
If IsNumeric(TextBox9.Text) Then
    exp = CDbl(TextBox9.Text)
    exp2 = CDbl(TextBox9.Text)
Else
    MsgBox("Please input a number.")
End If
If CheckBox1.Checked = True Then
    exp = exp * 2
End If
If CheckBox2.Checked = True Then
    exp = exp * 1.5
End If
If CheckBox3.Checked = True Then
    exp = exp * 1.3
End If
If CheckBox4.Checked = True Then
    exp = exp * 1.5
End If
If CheckBox5.Checked = True Then
    exp2 = exp + (exp2 * 1.1)
End If

exptotal = exp + exp2

If exp <> 0 Then
    Label37.Text = totalexp
End If

Please help!!