The document describes code for a payroll application and a number application.
For the payroll application, it allows the user to enter salaries, calculates the average salary, and counts how many salaries are above the average. It also clears the data.
For the number application, it allows the user to enter numbers, counts how many are positive, negative, and zero, and clears the data.
The document describes code for a payroll application and a number application.
For the payroll application, it allows the user to enter salaries, calculates the average salary, and counts how many salaries are above the average. It also clears the data.
For the number application, it allows the user to enter numbers, counts how many are positive, negative, and zero, and clears the data.
Public SUELDO(69), I, S As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SUELDO(I) = TextBox1.Text ListBox1.Items.Add(SUELDO(I)) S = S + SUELDO(I) I = I + 1 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim K, C As Integer Dim PROM As Double PROM = S / I K = I - 1 For I = 0 To K If SUELDO(I) > PROM Then C = C + 1 End If Next TextBox2.Text = PROM TextBox3.Text = C End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim X As Integer TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" ListBox1.Items.Clear() For X = 0 To 69 SUELDO(X) = 0 Next I = 0 S = 0 End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click End Sub End Class
8.Public Class Form1
Public NRO(99), I, S As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NRO(I) = TextBox1.Text ListBox1.Items.Add(NRO(I)) I = I + 1 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim K, C1, C2, C3 As Integer K = I - 1 For I = 0 To K If NRO(I) > 0 Then C1 = C1 + 1 ElseIf NRO(I) = 0 Then C2 = C2 + 1 Else C3 = C3 + 1 End If Next TextBox2.Text = C1 TextBox3.Text = C2 TextBox4.Text = C3 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim X As Integer TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" ListBox1.Items.Clear() For X = 0 To 99 NRO(X) = 0 Next I = 0 End Sub