Then I solve the percentage. dblResults = dblPoints/CDbl(strMax)
The first step is to store the minimum percentage points in one dimensional array. I did that.
The second step is to store the grades in one dimensional array. I did that.
The arrays should be parallel arrays. <------ Having trouble with it
It then should display the corresponding grade from the strGrades array <---- Not done.
I'm having trouble to display arrays in that are parallel.
I tried this one http://www.dreaminco...ased-on-points/
but some of them, I find it complicated, I just want to make this easier to code.
Any ideas.
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain
' declare class variable
Private strMax As String
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub txtPoints_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPoints.Enter
txtPoints.SelectAll()
End Sub
Private Sub txtPoints_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPoints.KeyPress
' accepts only numbers and the Backspace key
If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Private Sub txtPoints_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPoints.TextChanged
lblGrade.Text = String.Empty
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' get the total number of possible points
strMax =
InputBox("Enter the total possible points.", "Professor Carver")
End Sub
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' display the grade the student gets
Dim dblPoints As Double
Dim dblResults As Double
Dim strGrade() As String =
{"A", "B", "C", "D", "F"}
Dim dblPer() As Double =
{0.9, 0.8, 0.7, 0.6, 0.5}
Double.TryParse(txtPoints.Text, dblPoints)
' displays the percentage the student recieves
dblResults = dblPoints / CDbl(strMax)
' determines the grade
For intGrade As Integer = 0 To strGrade.Length
If dblResults <= dblPer(intGrade) Then
End If
Next intGrade
End Sub
End Class
Thanks
This post has been edited by blackbyron: 05 November 2011 - 11:06 AM

New Topic/Question
Reply



MultiQuote




|