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

Public Class Form1 Private Sub clearBtn_Click(ByVal sender As System.Object, ByV

ID: 3927310 • Letter: P

Question

Public Class Form1
Private Sub clearBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearBtn.Click
'cleat the input and result
inputTxt.Text = ""
resultLabel.Text = ""
End Sub

'close the form
Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click
'close the application
Me.Close()
End Sub

'Double click on the calculat button and write the following code
Private Sub cntBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cntBtn.Click

'Set the following variables to zero
Dim count As Integer = 0
Dim value As Integer = 0
Dim index As Integer = 0

If CInt(inputTxt.Text) > 1000 Then
textBox.Text = "Please Enter a 3 Digit Number"
'set focus to inputtext
inputTxt.Focus()
Else

'get input text and convert to integer
value = Convert.ToInt32(inputTxt.Text)

For index = 1 To value
If index Mod 2 = 0 Then
count = count + 1
End If
Next
resultLabel.Text = "This number contains " + CStr(count) + " even digits"
End If


End Sub
End Class

The program must look like the following application: Sample Run 1: g Even Digit Counter 1 Input a 3 digit number: This number contains 3 even digits. Count Even Digits Clear Exit

Explanation / Answer

Public Class Form1
Private Sub clearBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearBtn.Click
'cleat the input and result
inputTxt.Text = ""
resultLabel.Text = ""
End Sub

'close the form
Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click
'close the application
Me.Close()
End Sub

'Double click on the calculat button and write the following code
Private Sub cntBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cntBtn.Click

'Set the following variables to zero
Dim count As Integer = 0
Dim value As Integer = 0
Dim index As Integer = 0

If CInt(inputTxt.Text) > 1000 Then
textBox.Text = "Please Enter a 3 Digit Number"
'set focus to inputtext
inputTxt.Focus()
Else

'get input text and convert to integer
value = Convert.ToInt32(inputTxt.Text)

For index = 1 To value
If index Mod 2 = 0 Then
count = count + 1
End If
Next
resultLabel.Text = "This number contains " + CStr(count) + " even digits"
End If


End Sub
End Class

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