Creating student grading programs in VB.NET

Posted on 2006-03-31
Last Modified: 2008-03-06
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


 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
Question by:howardneal
    LVL 5

    Accepted Solution

    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
    If (AboveAverageRadioButton3.Checked) Then GradeTextBox1.Text =  FINALGRADE+ 5   = remove the "'s for addition  " denotes a string

    HTH get you going
    LVL 7

    Expert Comment

    ' First calculate the numeric grade and then convert it to a letter

    Dim Grade As Double
    Dim LetterGrade As String


    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    prevent lose focus 6 48 Excel Add-in TaskPane not opening 3 34
    SQL Server 2008 Error 7 32
    Merging PDFs with VB.NET 10 11
    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now