Its purpose is to:
1. take an integer entered by the user in a text box (named txtInput) and
2. perform a calculation and determine whether the number classification is:
2. perform a calculation and determine whether the number classification is:
a. a perfect number (the sum of the integer's divisors equals the original number),
b. an abundant number (the sum of the number's divisors is greater than the original number), or
c. a deficient number (the sum of the number's divisors is less than the original number), and
3. displays the number's class in a text box (named txtOutput).b. an abundant number (the sum of the number's divisors is greater than the original number), or
c. a deficient number (the sum of the number's divisors is less than the original number), and
Could someone please point me in the right direction? I'm very confused and frustrated. I've been searching for help for a couple days but can't find anything other than similar programs written in C, C++ or Java.
Public Class Form1
Private Sub btnClassify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClassify.Click
Dim intCount As Integer
Dim n As Integer ' number entered by user
Dim m As Integer ' counter? or is j the counter?
Dim half As Integer ' holds the divisors
Dim sum As Integer = 1 ' holds the sum of the divisors
For j = 2 To m
n = CInt(n).ToString
half = (n \ 2 Mod 0)
sum = half * (2 * n + (n - 1) * m)
If n = sum Then
txtOutput.Text = "perfect"
ElseIf n < sum Then
txtOutput.Text = "abundant"
ElseIf n > sum Then
txtOutput.Text = "deficient"
End If
intCount += 1
Next j
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtInput.Clear()
txtOutput.Clear()
' give focus to the first textbox
txtInput.Focus()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class

New Topic/Question
Reply



MultiQuote





|