Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An employer wants to evaluate the mathematical skills of potential employee\'s.

ID: 3830375 • Letter: A

Question

An employer wants to evaluate the mathematical skills of potential employee's.

To do this, a Visual Basic program generates and displays four random numbers in a range of 10-99 which the potential employee must add and the enter the sum.

Visual Basic

If the answer is incorrect, this is reported to the user who must try again.

The total time computed until the correct answer is entered and then is reported on the printer for the employer along with the following assessment:

<10 seconds = Excellent
10 - 20 seconds = Good
20 - 30 seconds = Average
30 - 40 seconds = Poor
>40 seconds = Very Poor

Explanation / Answer

Here is the code for the VB for your problem.

Public Class Form1
Dim add As Integer
Dim datTim1 As Date
Dim datTim2 As Date
Dim diff As Long
Dim result As String
Private Sub btnRnd_Click(sender As Object, e As EventArgs) Handles btnRnd.Click
datTim1 = Now
Randomize()
Dim value As Integer = CInt(Int((99 * Rnd()) + 10))
txt1.Text = value
value = CInt(Int((99 * Rnd()) + 10))
txt2.Text = value
txt3.Text = CInt(Int(99 * Rnd()) + 10))
txt4.Text = CInt(Int(99 * Rnd()) + 10))
add = Integer.Parse(txt1.Text) + Integer.Parse(txt2.Text) + Integer.Parse(txt3.Text) + Integer.Parse(txt4.Text)

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (Integer.Parse(txtAnswer.Text) = add) Then
datTim2 = Now
diff = DateDiff(DateInterval.Second, datTim1, datTim2)
txtTime.Text = Long.Parse(diff)

If (diff < 10) Then
result = "Excellent"
txtResult.Text = result
txtResult.Text = result
txtTime.Text = diff
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.Print()
End If
ElseIf (diff >= 10 And diff <= 20) Then
result = "Good"
txtResult.Text = result
txtResult.Text = result
txtTime.Text = diff
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.Print()
End If
ElseIf (diff >= 10 And diff <= 20) Then
result = "Average"
txtResult.Text = result
txtResult.Text = result
txtTime.Text = diff
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.Print()
End If
ElseIf (diff > 20 And diff <= 30) Then
result = "Poor"
txtResult.Text = result
txtResult.Text = result
txtTime.Text = diff
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.Print()
End If
Else
result = "Very Poor"
txtResult.Text = result
txtResult.Text = result
txtTime.Text = diff
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.Print()
End If
End If
Else
txtResult.Text = ""
txtTime.Text = 0
MsgBox("try again please.")
btnRnd_Click(sender, e)
End If

  


End Sub
End Class

We have 4 text boxes to get the random number.

One button to generate random number.

one button to validate

text boxes to store the time and result

print dialog and print document to print the form.

Let me know if you need more details.

Thanks

Nikhil Jain

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote