1 Replies - 97 Views - Last Post: 30 December 2017 - 12:30 PM Rate Topic: -----

#1 codegal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-December 17

Grade Application Help

Posted 30 December 2017 - 12:18 PM

Here is my assignment I already have the name form working. However, I am having trouble with the grades. When I click the submit button I keep getting System.Windows.Forms along with the your grade and grade letter answer. Thank you

You are going to create a grade application that allows the user to enter grades for the class. These scores are all out of 100 points.

The project will contain at least 3 forms. The first form will ask the user for the name of the student and put the student’s name on the form.

On the main form, the user will put in scores for forums (30% of the grade), assignments (45% of the grade), and the final project (25% of the final grade). At least one of these categories will generate a new form where the user will choose the score from a drop-down menu with a range of scores from 0-100. (Most likely you will want to do this for the final project score since there is only 1 final project)

Numbers of Grades for Each Category:
Forums: 8
Assignments: 8
Final Project: 1

After these grades are all entered, the program will display the average score for each category, the average for the class, and the letter grade for that person. The command buttons will calculate (the total, the average, and the letter grade), clear, print (make sure you can’t see the command buttons when you print), and Exit.


Grading Scale 
							73% - 77% = C 
	93% - 100% = A 				70% - 72% = C- 
	90% - 92% = A- 				68% - 69% = D+ 
	88% - 89% = B+ 				63% - 67% = D 
	83% - 87% = B 				60% - 62% = D- 
	80% - 82% = B- 				0% - 59% = F 
	78% - 79% = C+ 


Option Explicit On
Option Strict On
Option Infer Off

Public Class FrmMain
    Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
        lblName.Text = FrmName.txtFirstName.Text
        lblLastName.Text = FrmName.txtLastName.Text
    End Sub
    ''' <summary>
    ''' hides the FrmMain and opens FrmFinalGrade
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    Private Sub btnFinal_Click(sender As Object, e As EventArgs) Handles btnFinal.Click
        Me.Hide()
        FrmFinalGrade.Show()
    End Sub
    ''' <summary>
    ''' closes the application
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
    ''' <summary>
    ''' clears the text boxes
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        txtAssignmentOne.Text = ""
        txtAssignmentTwo.Text = ""
        txtAssignmentThree.Text = ""
        txtAssignmentFour.Text = ""
        txtAssignmentFive.Text = ""
        txtAssignmentSix.Text = ""
        txtAssignmentSeven.Text = ""
        txtAssignmentEight.Text = ""
        txtForumOne.Text = ""
        txtForumTwo.Text = ""
        txtForumThree.Text = ""
        txtForumFour.Text = ""
        txtForumFive.Text = ""
        txtForumSix.Text = ""
        txtForumSeven.Text = ""
        txtForumEight.Text = ""
    End Sub
    ''' <summary>
    ''' calculates the average test score of forums, assignments, and final
    ''' and displays them in lblAAvg, lblFAvg, and lblYScore the average in labels
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
        ' declares variabes

        Dim ForumScore1 As Double
        Dim ForumScore2 As Double
        Dim ForumScore3 As Double
        Dim ForumScore4 As Double
        Dim ForumScore5 As Double
        Dim ForumScore6 As Double
        Dim ForumScore7 As Double
        Dim ForumScore8 As Double
        Dim Assignment1 As Double
        Dim Assignment2 As Double
        Dim Assignment3 As Double
        Dim Assignment4 As Double
        Dim Assignment5 As Double
        Dim Assignment6 As Double
        Dim Assignment7 As Double
        Dim Assignment8 As Double

        ' get the users scores entered
        ForumScore1 = CDbl(txtForumOne.Text)
        ForumScore2 = CDbl(txtForumTwo.Text)
        ForumScore3 = CDbl(txtForumThree.Text)
        ForumScore4 = CDbl(txtForumFour.Text)
        ForumScore5 = CDbl(txtForumFive.Text)
        ForumScore6 = CDbl(txtForumSix.Text)
        ForumScore7 = CDbl(txtForumSeven.Text)
        ForumScore8 = CDbl(txtForumEight.Text)
        Assignment1 = CDbl(txtAssignmentOne.Text)
        Assignment2 = CDbl(txtAssignmentTwo.Text)
        Assignment3 = CDbl(txtAssignmentThree.Text)
        Assignment4 = CDbl(txtAssignmentFour.Text)
        Assignment5 = CDbl(txtAssignmentFive.Text)
        Assignment6 = CDbl(txtAssignmentSix.Text)
        Assignment7 = CDbl(txtAssignmentSeven.Text)
        Assignment8 = CDbl(txtAssignmentEight.Text)


        ' Calculate the average score

        Dim FAns As Double = (ForumScore1 + ForumScore2 + ForumScore3 + ForumScore4 + ForumScore5 +
           ForumScore6 + ForumScore7 + ForumScore8) * 0.3 / 8
        Dim Aans As Double = (Assignment1 + Assignment2 + Assignment3 + Assignment4 + Assignment5 +
            Assignment6 + Assignment7 + Assignment8) * 0.45 / 8

        ' display the forum average score
        lblAAvg.Text = FAns.ToString
        lblFAvg.Text = Aans.ToString

        Dim FinGra As String = FrmFinalGrade.cboFinalScore.SelectedItem
        ' add the forum score total, assignment score total, and cboFinal Score selection together for final score
        Dim FinalAns As String = FAns.ToString + Aans.ToString + FinGra
        lblYGrade.Text = FinalAns.ToString

        ' shows the final score as a letter
        Dim LGAns As String

        If (Double.TryParse(lblLetterGrade.Text, FinalAns)) >= 93 And FinalAns <= 100 Then
            LGAns = "A"

        ElseIf FinalAns >= 90 And FinalAns <= 92 Then
            LGAns = "A-"

        ElseIf FinalAns >= 88 And FinalAns <= 89 Then
            LGAns = "B+"

        ElseIf FinalAns >= 83 And FinalAns <= 87 Then
            LGAns = "B"

        ElseIf FinalAns >= 80 And FinalAns <= 82 Then
            LGAns = "B-"

        ElseIf FinalAns >= 78 And FinalAns <= 79 Then
            LGAns = "C+"

        ElseIf FinalAns >= 73 And FinalAns <= 77 Then
            LGAns = "C"

        ElseIf FinalAns >= 70 And FinalAns <= 72 Then
            LGAns = "C-"

        ElseIf FinalAns >= 68 And FinalAns <= 69 Then
            LGAns = "D+"

        ElseIf FinalAns >= 63 And FinalAns <= 67 Then
            LGAns = "D"

        ElseIf FinalAns >= 60 And FinalAns <= 62 Then
            LGAns = "D-"

        Else
            LGAns = "F"
        End If
        lblLetterGrade.Text = CDbl(LGAns)
    End Sub
End Class
:code:

This post has been edited by modi123_1: 30 December 2017 - 12:28 PM
Reason for edit:: In the future, please use the [code] tag button in the editor..


Is This A Good Question/Topic? 0
  • +

Replies To: Grade Application Help

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13661
  • View blog
  • Posts: 54,531
  • Joined: 12-June 08

Re: Grade Application Help

Posted 30 December 2017 - 12:30 PM

Where do you create the object for FrmFinalGrade?

As in 'dim foo as new FrmFinalGrade'?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1