• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 748
  • Last Modified:

Creating student grading programs in VB.NET

I need to develope a program that assigns a letter grade (A for 90 or above, B for 80 to 89, C for 70 to 79, D for 60 to 69, F for 0 to 59) to studen't assignments based on a test score and other factors.  I will use a numeric up down control for test score input, a number of radio button controls to determine the final grade based on extra credit on a project.  The radio button value will be 0 for no extra credit, 3 points for an average grade on the extra credit project, and 5 points for an above average score on the extra credit project.  I will also be using radio buttons to subtract points for assingments not turned in on time.  I will subtract 5 points for assignments turned in 1 to 2 days late.  If an assignment is turned in more than 2 days late, an automatic final score of 0 will be given.  The default must be "On Time"
The final grade will be displayed in a read-only text box.

The user interface is already designed.

Here is the code that I have so far and it is giving me fits...please help fast!!


Dim NumericUpDown1_value = NumericUpDown1_value

Select Case FINALGRADE

 Case 0 FINALGRADE = "A >=90"
 Case 1 FINALGRADE = "B = 80..89"
 Case 2 FINALGRADE = "C = 70..79"
 Case 3 FINALGRADE = "D = 60..69"
 Case 4 FINALGRADE = "F = 0..59"

End Select

End Sub Private Sub

GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WOrkLateGroupBox2.Enter

End Sub

 Private Sub CalulateButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalulateButton1.Click

Dim FINALGRADE As Integer FINALGRADE = NumericUpDown1.Value
Dim HumericUpDown1 As Double If (NoneRadioButton1.Checked) Then

GradeTextBox1.Text = "FINALGRADE"

End If

 If (AverageRadioButton2.Checked) Then GradeTextBox1.Text = "FINALGRADE + 3"

End If

If (AboveAverageRadioButton3.Checked) Then GradeTextBox1.Text = "FINALGRADE+ 5"

End If

If (OnTimeRadioButton4.Checked) Then GradeTextBox1.Text = "FINALGRADE"

End If

If (OneDayLateRadioButton5.Checked) Then GradeTextBox1.Text = "FINALGRADE - 5" End If
 If (TwoDaysLateRadioButton6.Checked) Then GradeTextBox1.Text = "FINALGRADE = 0" End If

End Sub

I am very new to this and appreciate all the help I can get
0
howardneal
Asked:
howardneal
1 Solution
 
razorback041Commented:
from the top, i will try to catch as much as i see in a short time

your case statement

select case FinalGrade
    case 90 to 100
        LetterGrade = "A"
    case 80 to 89
        LetterGrade = "B"

you can't mix strings and integers, so you need two different variables above FinalGrade and LetterGrade or whatever...

however, this needs to be the last thing that is run before displaying the grades, as you need to evaluate the letter AFTER all the calculations (just making sure, I am sure you already had that)

in your if statements
i.e.
If (AboveAverageRadioButton3.Checked) Then GradeTextBox1.Text =  FINALGRADE+ 5   = remove the "'s for addition  " denotes a string

HTH get you going
0
 
Joe_GriffithCommented:
' First calculate the numeric grade and then convert it to a letter

Dim Grade As Double
Dim LetterGrade As String

Grade=NumericUpDown1.Value

If AverageRadioButton2.Checked Then Grade += 3
If AboveAverageRadioButton3.Checked Then Grade += 5
If OneDayLateRadioButton5.Checked Then Grade -= 5
If TwoDaysLateRadioButton6.Checked Then Grade = 0

' Now covert the results to a letter
Select Case Grade
    case 90 to 100 :  LetterGrade = "A"
    case 80 to 89:     LetterGrade = "B"
    ...
End Select

' Finally display the grade
GradeTextBox1.Text = LetterGrade

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now