0% found this document useful (0 votes)
57 views8 pages

Programacion de Computadoras Laboratorio 8: Sub Byval As Double Byref As Double Byref As Double

The document discusses several Visual Basic programming exercises for a computer programming laboratory, including procedures to convert between units of moles, validate dates, find the highest and lowest digits in a number, convert between temperature scales, and calculate cost based on quantity. It provides the code for each procedure and instructions on how to call and use the procedures.
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)
57 views8 pages

Programacion de Computadoras Laboratorio 8: Sub Byval As Double Byref As Double Byref As Double

The document discusses several Visual Basic programming exercises for a computer programming laboratory, including procedures to convert between units of moles, validate dates, find the highest and lowest digits in a number, convert between temperature scales, and calculate cost based on quantity. It provides the code for each procedure and instructions on how to call and use the procedures.
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/ 8

PROGRAMACION DE COMPUTADORAS

LABORATORIO 8
PARA REALIZAR UNA REACCION QUÍMICA RELACIONADO A LA INDUSTRIA NECESITA SABER QUÉ
CANTIDAD DE MOLES SE AGREGA PARA OBTENER UNA SOLUCIÓN PERO SE LE PIDE AL INGENIERO
QUÍMICO REALIZAR UN INVENTARIO DONDE MUESTRE DICHO MOL EN RESPECTIVAS UNIDADES:
MILIMOL Y CENTIMOL.
HACER UN PROGRAMA QUE CONVIERTA UN CIERTO NÚMERO DE MOL EN MILIMOL Y CENTIMOL.

Sub EUIVALENTE_MOL(ByVal MOL As Double, ByRef MILI As Double, ByRef CENTI As Double)
CENTI = MOL * (10 ^ (-2))
MILI = MOL * (10 ^ (-3))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim MOL, CENTI, MILI As Integer
MOL = TextBox1.Text
EUIVALENTE_MOL(MOL, MILI, CENTI)
TextBox2.Text = CENTI
TextBox3.Text = MILI
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

CONSTRUIR UN PROCEDIMIENTO QUE PERMITE VALIDAR UNA FECHA INGRESADA COMO DÍA, MES
AÑO, DEVOLVIENDO UN INDICADOR LÓGICO SOBRE LA VALIDEZ O INVALIDEZ DE LA FECHA
INGRESADA. El año aceptado debe ser mayor a 1990
Public Class Form1

Sub VALIDAR_FECHA(ByVal DD As Integer, ByVal MM As Integer, ByVal AA As Integer,


ByRef MENSA As Boolean)
Dim ULT_DIA As Integer
Select Case MM
Case 1, 3, 5, 7, 8, 10, 12 : ULT_DIA = 31
Case 4, 6, 9, 11 : ULT_DIA = 30
Case
If AA Mod 4 = 0 Then
ULT_DIA = 29
Else
ULT_DIA = 28
End If
Case Else
MessageBox.Show(" ERROR .... INGRESE EL MES CORRECTO")
End Select
MENSA = (DD >= 1 And DD <= ULT_DIA) And (MM >= 1 And MM <= 12) And (AA >
1990)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim DD, MM, AA As Integer
Dim MENSA As Boolean
DD = TextBox1.Text
MM = TextBox2.Text
AA = TextBox3.Text
VALIDAR_FECHA(DD, MM, AA, MENSA)

If MENSA Then
TextBox4.Text = "FECHA VALIDA"
Else
TextBox4.Text = "FECHA INVALIDA"
End If
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
End Class
Sub CAL_DIGITO(ByVal NRO As Integer, ByRef DMAY As Integer, ByRef DMEN As Integer)
Dim D As Integer
DMEN = 9
While NRO > 0
D = NRO Mod 10
If D > DMAY Then
DMAY = D
End If
If D < DMEN Then
DMEN = D
End If
NRO = Int(NRO / 10)
End While
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim NRO, DMAY, DMEN As Integer
NRO = TextBox1.Text
CAL_DIGITO(NRO, DMAY, DMEN)
TextBox2.Text = DMAY
TextBox3.Text = DMEN

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
End Class
Function CONV_F(ByVal C As Double) As Double
CONV_F = ((9 * C) + 160) / 5
End Function
Function CONV_R(ByVal C As Double) As Double
CONV_R = ((9 * C) + 2460) / 5
End Function
Function CONV_K(ByVal C As Double) As Double
CONV_K = C + 273
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim C, F, R, K As Double
C = TextBox1.Text
TextBox2.Text = CONV_F(C)
TextBox3.Text = CONV_R(C)
TextBox4.Text = CONV_K(C)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

End Sub
End Class
Public Class Form1

Function CALCOSTO(ByVal UNID As Integer) As Integer


If UNID < 5 Then
CALCOSTO = UNID * 44
ElseIf UNID < 10 Then
CALCOSTO = UNID * 32
Else
CALCOSTO = UNID * 28
End If
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim UNID As Integer
UNID = TextBox1.Text
TextBox2.Text = CALCOSTO(UNID)

You might also like