The document contains code for multiple exercises in Visual Basic.NET. It defines classes and buttons for entering user input, performing calculations, and displaying output. The code samples show how to calculate angles, payment amounts, calendar dates, frequency counts and more based on input values and conditional logic.
The document contains code for multiple exercises in Visual Basic.NET. It defines classes and buttons for entering user input, performing calculations, and displaying output. The code samples show how to calculate angles, payment amounts, calendar dates, frequency counts and more based on input values and conditional logic.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5
Ejercicio 1
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g, m, s, b As Double
Dim clas As String g = TextBox1.Text m = TextBox2.Text s = TextBox3.Text b = g + (m / 60) + (s / 3600) If b = 0 Then clas = "nulo" ElseIf b < 90 Then clas = "agudo" ElseIf b = 90 Then clas = "recto" ElseIf b < 180 Then clas = "obtuso" ElseIf b = 180 Then clas = "llamo" ElseIf b < 360 Then clas = "concavo" Else clas = "conpleto" End If TextBox4.Text = clas End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub End Class
Ejercico 3
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim h, m, dia As Integer Dim pago As Double h = TextBox1.Text m = TextBox2.Text dia = TextBox3.Text If dia <= 4 Then If m >= 5 Then pago = 3.5 * (h + 1) Else pago = 3.5 * h End If ElseIf dia <= 6 Then If m >= 5 Then pago = 4.5 * (h + 1) Else pago = 4.5 * h End If Else If m >= 5 Then pago = 2.5 * (h + 1) Else pago = 2.5 * h
End If
End If
TextBox4.Text = pago
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub End Class
Ejercicio 5
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim y, x As Integer y = TextBox1.Text If y <= 11 Then x = 3 * y + 30 ElseIf y <= 33 Then x = y * y - 10 ElseIf y <= 64 Then x = y ^ 3 + y ^ 2 - 1 Else x = 0
End If TextBox2.Text = x
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub End Class
Ejercicio 4 Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ht, tn, he, sb, d, sn As Integer ht = TextBox1.Text tn = TextBox2.Text If ht <= 48 Then sb = tn * ht Else sb = (tn * 48) + (ht - 48) * 1.15 * tn End If If sb >= 1000 Then d = 0.12 * sb Else d = 0 End If sn = sb - d TextBox3.Text = sb TextBox4.Text = d TextBox5.Text = sn
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub End Class
Ejercicio 2 Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim m, a, cd As Integer Dim nombre As String m = TextBox1.Text a = TextBox2.Text Select Case m Case 1 : nombre = "enero" Case 2 : nombre = "febrero" Case 3 : nombre = "marzo" Case 4 : nombre = "abril" Case 5 : nombre = "mayo" Case 6 : nombre = "junio" Case 7 : nombre = "julio" Case 8 : nombre = "agosto" Case 9 : nombre = "septimbre " Case 10 : nombre = "octubre" Case 11 : nombre = "novienbre" Case 12 : nombre = "diciembre " Case Else nombre = "error" End Select Select Case m Case 1, 3, 5, 7, 8, 10, 10 : cd = 31 Case 4, 6, 9 : cd = 30 Case 2 : If a Mod 4 = 0 Then cd = 29 Else cd = 28 End If End Select
TextBox3.Text = nombre TextBox4.Text = cd
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub End Class Ejercicio 4
Public Class Form1 Public c1, c2, c3, c4, c5, c6 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n As Integer n = TextBox1.Text ListBox1.Items.Add(n) Select Case n Case 1 : c1 = c1 + 1 Case 2 : c2 = c2 + 1 Case 3 : c3 = c3 + 1 Case 4 : c4 = c4 + 1 Case 5 : c5 = c5 + 1 Case Else c6 = c6 + 1 End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Text = c1 TextBox3.Text = c2 TextBox4.Text = c3 TextBox5.Text = c4 TextBox6.Text = c4 TextBox7.Text = c6
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" ListBox1.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Close()