0% found this document useful (0 votes)
46 views11 pages

Labo 3

The document contains code for 8 exercises that use conditional logic (If/Else statements) to calculate or classify values based on input values. Each exercise contains code to handle button clicks to run the calculations and clear the input/output fields. The code takes user input, performs calculations or comparisons based on the input values, and outputs the results to text boxes.
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
46 views11 pages

Labo 3

The document contains code for 8 exercises that use conditional logic (If/Else statements) to calculate or classify values based on input values. Each exercise contains code to handle button clicks to run the calculations and clear the input/output fields. The code takes user input, performs calculations or comparisons based on the input values, and outputs the results to text boxes.
Copyright
© © All Rights Reserved
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/ 11

LABORATORIO N 3

EJERCICIO N1
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles
Button1.Click
Dim GG, MM, SS, B As Integer
Dim CLASI As String
GG = TextBox1.Text
MM = TextBox2.Text
SS = TextBox3.Text
B = GG + (MM / 60) + (SS / 3600)
If B = 0 Then
CLASI = "NULO"
ElseIf B < 90 Then
CLASI = "AGUDO"
ElseIf B = 90 Then
CLASI = "RECTO"
ElseIf B < 180 Then
CLASI = "OBTUSO"
ElseIf B = 180 Then
CLASI = "LLANO"
ElseIf B < 360 Then
CLASI = "CONCAVO"
Else
CLASI = "COMPLETO"
End If
TextBox4.Text = CLASI
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles
Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click
End
End Sub
End Class

EJERCICIO N2
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim CATEG As String
Dim PROM, PENSION, DSCTO, NPENSION As Double
CATEG = TextBox1.Text
PROM = TextBox2.Text
If CATEG = "A" Then
PENSION = 550
ElseIf CATEG = "B" Then
PENSION = 500
ElseIf CATEG = "c" Then
PENSION = 460
Else
PENSION = 400
End If
If PROM <= 13.99 Then
DSCTO = 0
ElseIf PROM <= 15.99 Then
DSCTO = 0.1 * PENSION
ElseIf PROM <= 17.99 Then
DSCTO = 0.12 * PENSION
Else
DSCTO = 0.15 * PENSION
End If
NPENSION = PENSION - DSCTO

TextBox3.Text = DSCTO
TextBox4.Text = NPENSION
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
End
End Sub
End Class

EJERCICIO N3
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles
Button1.Click

Dim HE, MINE, HS, MINS As Integer


Dim D, P, R As Double
D = TextBox1.Text
HE = TextBox2.Text
MINE = TextBox3.Text
HS = TextBox4.Text
MINS = TextBox5.Text
If D = 0 Then
D = 3.5
End If
If D = 1 Then
D = 4.5
End If
If D = 2 Then
D = 2.5
End If
R = Math.Ceiling((MINS - MINE) / 60)
P = D * (HS - HE + R)
TextBox6.Text = P
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles
Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click
End
End Sub
End Class

EJERCICIO N4
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim SUELDO, AUMENTO, NSUELDO As Double
SUELDO = TextBox1.Text
If SUELDO <= 1000 Then
AUMENTO = 0.3 * SUELDO
ElseIf SUELDO <= 1500 Then
AUMENTO = 0.25 * SUELDO
Else
AUMENTO = 0.2 * SUELDO
End If
NSUELDO = SUELDO + AUMENTO
TextBox2.Text = AUMENTO
TextBox3.Text = NSUELDO
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 = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
End
End Sub
End Class

EJERCICIO N5
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles
Button1.Click
Dim Y, X As Double
Y = TextBox1.Text
If Y > 0 And Y <= 11 Then
X = 3 * Y + 30
ElseIf Y > 11 And Y <= 33 Then
X = Y * Y - 10
ElseIf Y > 33 And Y <= 64 Then
X=Y*Y*Y+Y*Y-1
Else
X=0
End If
TextBox2.Text = X
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles
Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click
End
End Sub
End Class

EJERCICIO N6
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim X As Integer
Dim FX As Double
X = TextBox1.Text
If X Mod 4 = 0 Then
FX = X ^ 3
ElseIf X Mod 4 = 1 Then
FX = X / 6
ElseIf X Mod 4 = 2 Then
FX = X ^ 2
ElseIf X Mod 4 = 3 Then
FX = X + 5
Else
FX = 0
End If
TextBox2.Text = FX
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
End
End Sub
End Class

EJERCICIO N7
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles
Button1.Click
Dim HT, TN As Integer
Dim SB, DES, SN As Double
HT = TextBox1.Text
TN = TextBox2.Text
If HT <= 48 Then
SB = HT * TN
ElseIf HT > 48 Then
SB = (48 * TN) + ((HT - 48) * 1.15 * TN)
End If
If SB > 1000 Then
DES = 0.12 * SB
ElseIf SB <= 1000 Then
DES = 0
End If
SN = SB - DES

TextBox3.Text = SB
TextBox4.Text = DES
TextBox5.Text = SN
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles
Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click
End
End Sub
End Class

EJERCICIO N8

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim P1, P2, P3, P4, W, PROM As Double
Dim CAT As String
W = 21
P1 = TextBox1.Text
P2 = TextBox2.Text
P3 = TextBox3.Text
P4 = TextBox4.Text
If P1 < W Then
W = P1
End If
If P2 < W Then
W = P2
End If
If P3 < W Then
W = P3
End If
If P4 < W Then
W = P4
End If
PROM = (P1 + P2 + P3 + P4 - W) / 3
If PROM < 10 Then
CAT = "D"
ElseIf PROM < 14 Then
CAT = "C"
ElseIf PROM < 17 Then
CAT = "B"
Else
CAT = "A"
End If
TextBox5.Text = PROM
TextBox6.Text = CAT
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 = ""
TextBox6.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
End
End Sub
End Class

You might also like