title: how to add, muiltiply and divide numbers in a bracket
body: <p>I was wondering if anyone could assist me in solving this math using vb net</p>
  
  <p>Dmj = 1(4+0.5)+2(1.5+0.5) + 2(2+0.5)+7(3+0.5) /12 12 is the total of numbers outside the bracket (i.e. 1+2+2+7)
   = 4.5+4+5+24.5
      12
  = 38/12
  =3.17</p>
  
  <p>Below is the code which does not give me the correct answer 3.17</p>
  
  <p>Public Class Form3</p>
  
  <pre><code>Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim Maxnumber As Integer
      Dim total, total2 As Integer
      Dim input, input2 As Integer
      Dim num As Integer
      Dim accu As Integer
      Maxnumber = CInt(InputBox("How many numbers to you wish to sum?"))
      total = 0
  
      For x = 1 To Maxnumber
          input = CInt(InputBox("Enter the number"))
  
          input2 = CInt(InputBox("Enter the Distance"))
  
          If input And input2 = Nothing Then
              Exit For
          Else
              num = CDbl(input)
              accu = CDbl(input2)
  
              total += num
              total2 = num * (accu + 0.5)
  
          End If
      Next
      MessageBox.Show(total2)
  End Sub
  </code></pre>
  
  <p>End Class</p>