0% found this document useful (0 votes)
30 views7 pages

Labo 3 de Programacion 2013

This document contains code for 6 programming problems. Problem 1 calculates the height of a triangle given its side lengths. Problem 3 calculates an output value based on an input value and different ranges. Problem 5 counts votes for different options and calculates percentages. Problem 6 calculates salary, deductions, and net salary based on hours worked and hourly pay rate.

Uploaded by

Cesar Alju
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)
30 views7 pages

Labo 3 de Programacion 2013

This document contains code for 6 programming problems. Problem 1 calculates the height of a triangle given its side lengths. Problem 3 calculates an output value based on an input value and different ranges. Problem 5 counts votes for different options and calculates percentages. Problem 6 calculates salary, deductions, and net salary based on hours worked and hourly pay rate.

Uploaded by

Cesar Alju
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/ 7

LABO 3

PROBLEMA NRO 1

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim A, B, C, HA, HB, HC, P, D As Integer
A = TextBox1.Text
B = TextBox2.Text
C = TextBox3.Text
If (A < B + C) And (B < A + C) And (C < A + B) Then
P = (A + B + C) / 2
D = P * (P - A) * (P - B) * (P - C)
HA = (2 * (D) ^ (1 / 2)) / A
HB = (2 * (D) ^ (1 / 2)) / B
HC = (2 * (D) ^ (1 / 2)) / C
Else
MessageBox.Show("LOS LADOS INGRESADOS NO DETERMINAN UN TRIANGULO")

End If
TextBox4.Text = HA
TextBox5.Text = HB
TextBox6.Text = HC
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

PROBLEMA 3
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim X, Y 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(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

PROBLEMA 5
Public Class Form1
Public C1, C2, C3, C4 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim V As Integer
V = TextBox1.Text
ListBox1.Items.Add(V)
If V = 1 Then
C1 = C1 + 1
ElseIf V = 2 Then
C2 = C2 + 1
ElseIf V = 3 Then
C3 = C3 + 1
ElseIf V = 4 Then

C4 = C4 + 1
Else : MessageBox.Show("ERROR..VOTO INVALIDO")
End If

End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Dim TOT As Integer
Dim P1, P2, P3, P4 As Double
TOT = C1 + C2 + C3 + C4
P1 = (C1 / TOT) * 100
P2 = (C2 / TOT) * 100
P3 = (C3 / TOT) * 100
P4 = (C4 / TOT) * 100
TextBox2.Text = C1
TextBox3.Text = C2
TextBox4.Text = C3
TextBox5.Text = C4
TextBox6.Text = P1
TextBox7.Text = P2
TextBox8.Text = P3
TextBox9.Text = P4
C1 = 0
C2 = 0
C3 = 0
C4 = 0
P1 = 0
P2 = 0
P3 = 0
P4 = 0

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 = ""
TextBox8.Text = ""
TextBox9.Text = ""
ListBox1.Items.Clear()
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


End
End Sub
End Class

PROBLEMA 6

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim HT As Integer
Dim TN, SB, D, SNETO As Double
HT = TextBox1.Text
TN = TextBox2.Text
If HT <= 48 Then
SB = HT * TN

Else
SB = (48 * TN) + (HT - 48) * (1.15 * TN)
End If
If SB > 1000 Then
D = 0.12 * SB
Else
D=0
End If
SNETO = SB - D
TextBox3.Text = SB
TextBox4.Text = D
TextBox5.Text = SNETO
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
End
End Sub
End Class

You might also like