New Member Join Date Mar 2008 Posts 2
I need help with the following problem, can someone try to help me understand what I have to fix or do. If have to use for the grade program TryParse, and the IF/ElseIF/Else.
This is my assignment:
In this exercise, you code an application for Professor Juarez. This application displays a letter grade based on the average of three test scores. Each test is worth 100 points. Display an appropriate message if any of the test scores are not numeric. Use the following chart to complete the procedure:
Test Average and Grade
When the user makes a change to the contents of a text box, the application should remove the contents of the XGradeLabel. Code the appropriate event procedures.
The application should select a text cox's existing text when the text box receives the focus. Code the appropriate event procedures.
Save the solution, then start the application. Test the application three times. For the first test, use scores of 90, 95 and 100. For the second test, use scores of 83, 72, and 65. For the third test, use scores of 40, 30, and 20.
If anyone can help please show explain what I have to do. I have started it but am lost how to code everything correctly.
I am showing what I did so far:
' Project name: Juarez Project
' Project purpose: The project displays a student's grade, which is
' based on three test scores entered by the user.
' Created/revised: on 03/04/08
Option Explicit On
Option Strict On
Public Class MainForm
Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub xDisplayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xDisplayButton.Click
Dim Test1 As Integer
Dim Test2 As Integer
Dim Test3 As Integer
Dim Display As Integer
Dim Grade As Integer
Integer.TryParse(Me.xTest1TextBox.Text, Test1)
Integer.TryParse(Me.xTest2TextBox.Text, Test2)
Integer.TryParse(Me.xTest3TextBox.Text, Test3)
Integer.TryParse(Me.xDisplayButton.Text, Display)
Integer.TryParse(Me.xGradeLabel.Text, Grade)
Dim grade As String
grade = Me.xGradeLabel.Text
If grade = "90-100" Then
Me.xGradeLabel.Text = "A"
ElseIf grade = "80-89" Then
Me.xGradeLabel.Text = "B"
ElseIf grade = "70-79" Then
Me.xGradeLabel.Text = "C"
ElseIf grade = "60-69" Then
Me.xGradeLabel.Text = "D"
ElseIf grade = "60-0" Then
Me.xGradeLabel.Text = "F"
Else
Me.xGradeLabel.Text = "Incorrect grade"
' display the grade totals
Grade = Test1 + Test2 + Test3