Quondam
10-16-2004, 02:08 AM
This is my assignment, I am a bit stuck and need a jumpstart making the random ints appear as math problems in input boxes, please help :)
You are to generate a math practice drill for elementary school students. These students need to practice their addition, subtraction and multiplication skills. The user will select the type of drill (enter either M for multiplication, S for subtraction or A for addition in a text box); the number of problems they wish to do (between 1 and 20 in another text box); and the high and low range to use for the drill (lowest number text box and highest number text box).
Once user clicks the Start button, check to make sure all the values in the text boxes are entered correctly (correct alphabetic letter or numeric and within the ranges specified), display any error messages precisely indicating what is wrong in a Message label (one error per line) for each mistake and exit the click procedure resetting all the textboxes. If everything is correct, generate 2 random integers and display the problem with the appropriate symbol in an InputBox. Check the answer entered and keep track of how many correct answers are given. Continue generating new random numbers for the number of problems the user specified. When all the problems are answered, display the percentage correct in the Message label and exit the click procedure.
Here is what I have so far.
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim strMath As String
Dim intLow As Integer
Dim intHigh As Integer
Dim intNumProb As Integer
Dim rndGenerator As New Random
Dim intNum As Integer
Dim intNum2 As Integer
'Declare variables
strMath = txtMath.ToString
intLow = Convert.ToInt16(txtLow)
intHigh = Convert.ToInt16(txtHigh)
intNumProb = Convert.ToInt16(txtNumProb)
intNum = rndGenerator.Next(intLow, intHigh)
intNum2 = rndGenerator.Next(intLow, intHigh)
If intNumProb < 1 or intNumProb > 20 || not intNumProb isnumeric then
MessageBox.Show(" Data must be a number between 1 and 20")
End If
Select Case strMath
Case "A"
Case "M"
Case "S"
Case Else
End Select
End Sub
You are to generate a math practice drill for elementary school students. These students need to practice their addition, subtraction and multiplication skills. The user will select the type of drill (enter either M for multiplication, S for subtraction or A for addition in a text box); the number of problems they wish to do (between 1 and 20 in another text box); and the high and low range to use for the drill (lowest number text box and highest number text box).
Once user clicks the Start button, check to make sure all the values in the text boxes are entered correctly (correct alphabetic letter or numeric and within the ranges specified), display any error messages precisely indicating what is wrong in a Message label (one error per line) for each mistake and exit the click procedure resetting all the textboxes. If everything is correct, generate 2 random integers and display the problem with the appropriate symbol in an InputBox. Check the answer entered and keep track of how many correct answers are given. Continue generating new random numbers for the number of problems the user specified. When all the problems are answered, display the percentage correct in the Message label and exit the click procedure.
Here is what I have so far.
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim strMath As String
Dim intLow As Integer
Dim intHigh As Integer
Dim intNumProb As Integer
Dim rndGenerator As New Random
Dim intNum As Integer
Dim intNum2 As Integer
'Declare variables
strMath = txtMath.ToString
intLow = Convert.ToInt16(txtLow)
intHigh = Convert.ToInt16(txtHigh)
intNumProb = Convert.ToInt16(txtNumProb)
intNum = rndGenerator.Next(intLow, intHigh)
intNum2 = rndGenerator.Next(intLow, intHigh)
If intNumProb < 1 or intNumProb > 20 || not intNumProb isnumeric then
MessageBox.Show(" Data must be a number between 1 and 20")
End If
Select Case strMath
Case "A"
Case "M"
Case "S"
Case Else
End Select
End Sub