|
-
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
-
Jan 24th, 2006, 04:38 PM
#2
Thread Starter
Junior Member
Re: Array and math calculation
-
Jan 24th, 2006, 05:00 PM
#3
Re: Array and math calculation
 Originally Posted by houdini
I have to create a program.....My code is below and it is obviously far from where it is needs to be.....
I didn't see any questions in your posts. We won't do your assignments for you, however; we will be happy to help with specific questions if you have any.
-
Jan 24th, 2006, 05:02 PM
#4
Thread Starter
Junior Member
Re: Array and math calculation
I'm not sure how to structure the array for the calcuations.
I figured out the integer counter though:
For intcounter = 1 To 10 Step 1
Average = (Test1 + Test2 + Test3) / 3
Next
stroutput = (String.Format("{0:c}", Average) & ControlChars.CrLf)
lstNames.Text = stroutput
Like that?
Where does the array come into play?
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
|