|
-
Jan 24th, 2006, 03:46 PM
#1
Thread Starter
Junior Member
Array and math calculation
I have to create a program the enters a student name in one textbox (txtName.Text), takes their test grades from three other textboxes and calculates their individual average to output it (lstnames.text) and then calculates the average of all of the students to output (lblClassOutput.Text).
My instructions state to declare an integer counter and a 10-by-2 string array as instance variables. Then store the student's name in the first column of the array and the student's average in the second column. The class average should be calculated using a function procedure.
My code is below and it is obviously far from where it is needs to be.
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim name As String = txtName.Text
Dim Test1 As Integer = txtTest1.Text
Dim Test2 As Integer = txtTest2.Text
Dim Test3 As Integer = txtTest3.Text
Dim Average As Integer
Dim TotalAvg As Integer
Dim stroutput As String
Dim ClassAvg(,) As String = New String(1, 9) {} _
Average = (Test1 + Test2 + Test3) / 3
stroutput = (String.Format("{0:c}", Average) & ControlChars.CrLf)
lstNames.Text = stroutput
End Sub
End Class ' FrmStudentGrades
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|