Need help with an assignment for a Grade Book

jle7385

New member
Joined
Apr 11, 2011
Messages
2
Programming Experience
Beginner
I was wondering if anyone could help me out with this problem?

Suppose a teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores.

Test Score Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F

Create an application that uses an array of strings to hold the five students names, an array of five strings to hold each students letter grades, and five arrays of four single precision numbers to hold each student's set of test scores.

Equip the application with a menu or a set of buttons that allows the application to perform the following:

Display a form that allows the user to enter or change the student names and their test scores.

Calculate and display each student's average test score and a letter grade based on the average.

For input validation do not accept test scores less that zero or greater than 100.




*I appreciate the help. I don't have any clue on where to start this. I'm not good with the array stuff at all. Any help would be appreciated.
 
Take a look at this for the arrays: Arrays in Visual Basic
I would some ListView control for the students names, with a MenuStrip and a ToolStrip for the add/delete/edit buttons. I would display the average score in one of the SubItems in the ListView. Use a NumericUpDown control for entering the score and set the min and max properties.

Here's little example of how you could get the letter score from a number:

VB.NET:
Private Function getTestScore(ByVal score As Integer) As String
  If score > 89 And score < 101 Then Return "A"
  If score > 79 And score < 90 Then Return "B"
  If score > 69 And score < 80 Then Return "C"
  If score > 59 And score < 70 Then Return "D"
  If score >= 0 And score < 60 Then Return "F"
  Return "Invalid Score"
End Function

And a little example on String Array's:

VB.NET:
Dim strStudents() As String = {"student1", "student2", "student3", "student4", student5"}
'For going through an array:
For i = 0 To strStudents.Length - 1
  MsgBox(strStudents(i))
Next
'For getting a specific value:
strStudents(value)

Instead of using the six different arrays like you are planning to do, also consider combining into a single array, like so:

VB.NET:
Dim strStudents() As String = {"student1,A,50,60,70,80", "student2,A,50,60,70,80", "student3,A,50,60,70,80", "student4,A,50,60,70,80", student5,A,50,60,70,80"}
'For going through the array:
For i = 0 To strStudents.Length - 1
  Dim strTemp() As String = strStudents(i).Split(",")
  'Now you can get whichever values you want from a single array:
  MsgBox(strTemp(0)) 'Returns name
Next


Hope this helps
-Josh
 
Back
Top