You are on page 1of 27

Laboratorio 01

Problema 01:
Option Explicit On
Option Strict On
Public Class frmProblema01
Private Sub txtCelcius_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSys
tem.EventArgs) Handles txtCelcius.TextChanged
If IsNumeric(txtCelcius.Text) Then
Dim celcius As Double = CDbl(txtCelcius.Text)
Dim fahrenheit As Double = ((celcius * 9) / 5) + 32
lblFahrenheit.Text = "La temperatura en grados Fahrenheit es: "& fahrenhei
t & "F"
ElseIf txtCelcius.Text.Trim.Length = 0 Then
lblFahrenheit.Text = ""
Else
lblFahrenheit.Text = "Ingrese una temperatura vlida."
EndIf
End Sub
End Class
Problema 02:
Option Explicit On
Option Strict On
Public Class frmProblema02
Private Sub txtCreditos_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSy
stem.EventArgs) Handles txtCreditos.TextChanged
If IsNumeric(txtCreditos.Text) Then
Dim creditos As Double = CDbl(txtCreditos.Text)
Dim matricula As Double = 70.0
Dim costoporcredito As Double = 250.0
Dim costototal As Double = (creditos * costoporcredito) + matricula
Dim numerocuotas As Double = 5
Dim costocuota As Double = costototal / numerocuotas
lblMonto.Text = "El monto total a pagar es de S/. "& Format(costototal,"0.
00") & vbNewLine & ("El monto de cada una de las " & Format(numerocuotas,"0") &
" es de S/. " & Format(costocuota,"0.00")
ElseIf txtCreditos.Text.Trim.Length = 0 Then
lblMonto.Text = ""
Else
lblMonto.Text = "Ingrese un nmero de crditos vlido."
EndIf
End Sub
End Class
Problema 03:
Option Explicit On
Option Strict On

Public Class frmProblema03


Private Sub txtImporte_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSys
tem.EventArgs) Handles txtImporte.TextChanged
If IsNumeric(txtImporte.Text) Then
Dim importe As Double = CDbl(txtImporte.Text)
Dim promocion As Double = 0.1
Dim monto As Double = importe * (1 - promocion)
lblMonto.Text = "El importe a cancelar es de S/. "& Format(monto,"0.00")
ElseIf txtImporte.Text.Trim.Length = 0 Then
lblMonto.Text = ""
Else
lblMonto.Text = "Ingrese un precio vlido."
EndIf
End Sub
End Class
Problema 04:
Option Explicit On
Option Strict On
Public Class frmProblema04
Private Sub txtDonacion_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSy
stem.EventArgs) Handles txtDonacion.TextChanged
If IsNumeric(txtImporte.Text) Then
Dim donacion As Double = CDbl(txtDonacion.Text)
Dim parteGeneral As Double = 0.5
Dim partePediatria As Double = 0.3
Dim parteGinecologia As Double = 1 - general - pediatria
Dim general As Double = donacion * parteGeneral
Dim pediatria As Double = donacion * partePediatria
Dim ginecologia As Double = donacion * parteGinecologia
lblReparto.Text = "Los montos a repartir la donacin son : " & vbNewLine & v
bNewLine & "Medicina General " & Format(parteGeneral,"0%") & " : S/. " & Format(
general,"0.00") & vbNewLine & "Pediatra " & Format(partePediatria,"0%") & " : S/.
" & Format(pediatria,"0.00") & vbNewLine & "Ginecologa " & Format(parteGinecolog
ia,"0%") & " : S/. " & Format(ginecologia,"0.00")
ElseIf txtDonacion.Text.Trim.Length = 0 Then
lblReparto.Text = ""
Else
lblReparto.Text = "Ingrese un monto vlido de donacin."
EndIf
End Sub
End Class
Problema 05:
Option Explicit On
Option Strict On
Public Class frmProblema05
Private Sub txtJabones_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSys
tem.EventArgs) Handles txtJabones.TextChanged
If IsNumeric(txtJabones.Text) Then
Dim jabones As Double = CDbl(txtJabones.Text)

Dim precio As Double = 2.5


Dim montoNormal As Double = jabones * precio
Dim promocionCompra As Double = 3
Dim promocionPaga As Double = 2
Dim promociones As Double = jabones \ promocionCompra
Dim sinPromocion AS Double = jabones mod promocionCompra
Dim montoPromocion As Double = ((promociones * promocionPaga) + sinPromoci
on) * precio
Dim ahorro As Double = montoNormal - montoPromocion
lblCuenta.Text = "El montos que se pagara sin la promocin es de S/. " & Form
at(montoNormal,"0.00") & vbNewLine "El monto a pagar con la promocin es de S/. "
& Format(montoPromocin,"0.00") & vbNewLine & "El ahorro en la compra es de S/. "
& Format(ahorro,"0.00")
ElseIf txtJabones.Text.Trim.Length = 0 Then
lblCuenta.Text = ""
Else
lblCuenta.Text = "Ingrese una cantidad vlida de jabones a comprar."
EndIf
End Sub
End Class
Problema 06:
Option Explicit On
Option Strict On
Public Class frmProblema06
Private Sub txtNumero_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSyst
em.EventArgs) Handles txtNumero.TextChanged
If IsNumeric(txtNumero.Text) Then
Dim numero As Integer = CInt(txtNumero.Text)
Dim m As Integer = numero \ 1000
numero = numero mod 1000
Dim c As Integer = numero \ 100
numero = numero mod 100
Dim d As Integer = numero \ 10
u = numero mod 10
suma = m + c + d + u
lblResultado.Text = "El nmero ingresado tiene:" & vbNewLine & vbNewLine & F
ormat(m,"0") "millares" & vbNewLine & Format(c,"0") "centenas" & vbNewLine & Fo
rmat(d,"0") "decenas" & vbNewLine & Format(u,"0") "unidades" & vbNewLine & "La
suma de sus dgitos es: " Format(suma,"0") & vbNewLine & "El nmero invertido es: "
& Format(u,"0") & Format(d,"0") & Format(c,"0") & Format(m,"0")
ElseIf txtNumero.Text.Trim.Length = 0 Then
lblResultado.Text = ""
Else
lblResultado.Text = "Debe ingresar un nmero entero mayor que cero y menor q
ue 10000"
EndIf
End Sub
End Class
Problema 07:
Option Explicit On
Option Strict On

Public Class frmProblema07


Private Sub txtVelocidadKH_TextChanged(ByVal sender AsSystem.Object, ByVal e A
sSystem.EventArgs) Handles txtVelocidadKH.TextChanged
If IsNumeric(txtVelocidadKH.Text) Then
Dim velocidadKH As Double = CDbl(txtVelocidadKH.Text)
Dim velocidadMS As Double = (KH * 1000) / 3600
lblvelocidadMS.Text = "La velocidad en metros por segundo (m/s) es: " & Fo
rmat(velocidadMS,"0.000")
ElseIf txtVelocidadKH.Text.Trim.Length = 0 Then
lblVelocidadMS.Text = ""
Else
lblVelocidadMS.Text = "Debe ingresar una velocidad vlida"
EndIf
End Sub
End Class
Problema 08:
Option Explicit On
Option Strict On
Public Class frmProblema08
Private Sub txtLitros_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSyst
em.EventArgs) Handles txtLitros.TextChanged
If IsNumeric(txtLitros.Text) Then
Dim litros As Double = CDbl(txtLitros.Text)
Dim galones As Double = litros / 3.79
Dim precioGalon As Double = 14.0
Dim monto As Double = galones * precioGalon
lblMonto.Text = "El monto a pagar es de S/." & Format(monto,"0.00")
ElseIf txtLitros.Text.Trim.Length = 0 Then
lblMonto.Text = ""
Else
lblMonto.Text = "Debe ingresar una cantidad vlida de litros de combustible
a comprar"
EndIf
End Sub
End Class
Problema 09:
Option Explicit On
Option Strict On
Public Class frmProblema09
Private Sub txtTotalSegundos_TextChanged(ByVal sender AsSystem.Object, ByVal e
AsSystem.EventArgs) Handles txtTotalSegundos.TextChanged
If IsNumeric(txtTotalSegundos.Text) Then
Dim totalSegundos As Integer = CInteger(txtTotalSegundos.Text)
Dim parcial As Integer = totalSegundos
Dim horas As Integer = parcial \ 3600
parcial = horas mod 3600
Dim minutos As Integer = parcial \ 60
Dim segundos As Integer = parcial mod 60
lblResultado.Text = Format (totalSegundos,"00") & "segundos equivalen a: "

& Format(horas,"00") & " horas " & Format(minutos,"00") & " minutos y " & Forma
t(segundos,"00") & " segundos.")
ElseIf txtTotalSegundos.Text.Trim.Length = 0 Then
lblResultado.Text = ""
Else
lblResultado.Text = "Debe ingresar un nmero entero mayor que cero."
EndIf
End Sub
End Class
Problema 10:
Option Explicit On
Option Strict On
Public Class frmProblema10
Private Sub txtAngulo_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSyst
em.EventArgs) Handles txtTotalAngulo.TextChanged
If IsNumeric(txtAngulo.Text) Then
Dim angulosexagesimal As Double = CDbl(txtAngulo.Text)
Dim anguloradial As Double = (angulosexagesimal * Math.PI) / 180
Dim seno As Double = Math.Sin(anguloradial)
Dim coseno As Double = Math.Cos(anguloradial)
Dim Tangente As Double = Math.Tan(anguloradial)
lblResultado.Text = "Las razones trigonomtricas del ngulo son:" & vbNewLine
& vbNewLine & "Seno : " & Format (seno,"0.0000") & vbNewLine & "Coseno : " & For
mat (coseno,"0.0000") & vbNewLine & "Tangente : " & Format (tangente,"0.0000")
ElseIf txtAngulo.Text.Trim.Length = 0 Then
lblResultado.Text = ""
Else
lblResultado.Text = "Debe ingresar un ngulo vlido."
EndIf
End Sub
End Class
Problema 11:
Option Explicit On
Option Strict On
Public Class frmProblema11
Private Sub txtAngulo_TextRadioMenor(ByVal sender AsSystem.Object, ByVal e AsS
ystem.EventArgs) Handles txtTotalRadioMenor.TextChanged
If IsNumeric(txtAlturaMayor.Text) And IsNumeric(txtRadioMayor.Text) And IsNu
meric(txtAlturaMenor.Text) And IsNumeric(txtRadioMenor.Text)Then
Dim alturaMayor As Double = CDbl(txtAlturaMayor.Text)
Dim radioMayor As Double = CDbl(txtRadioMayor.Text)
Dim alturaMenor As Double = CDbl(txtAlturaMenor.Text)
Dim radioMenor As Double = CDbl(txtRadioMenor.Text)Then
Dim volumen As Double = (Math.Pow(radioMayor,2) * Math.PI * alturaMayor) +
(Math.Pow(radioMenor,2) * Math.PI * alturaMenor)
lblVolumen.Text = "El volumen del slido es " & Format(volumen,"0.00") & " u
nidades cbicas."
ElseIf txtAngulo.Text.Trim.Length = 0 Then
lblVolumen.Text = ""
Else

lblVolumen.Text = "Debe ingresar medidas vlidas."


EndIf
End Sub
End Class

Laboratorio 2
Problema 01:
Option Explicit On
Option Strict On
Public Class frmProblema01
Private Sub frmProblema01_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim totalSegundos As Integer = Val(InputBox("Ingrese nmero de segundos: "
, "Clculo de tiempo", 0))
Dim parcial As Integer = totalSegundos
Dim horas As Integer = parcial \ 3600
parcial = totalSegundos Mod 3600
Dim minutos As Integer = parcial \ 60
Dim segundos As Integer = parcial Mod 60
Dim mensaje As String = Format(totalSegundos, "00") & " segundos equival
en a " & Format(horas, "00") & " horas " & Format(minutos, "00") & " minutos y "
& Format(segundos, "00") & " segundos."
MessageBox.Show(mensaje)
End Sub
End Class
Problema 02:
Option Explicit On
Option Strict On
Public Class frmProblema02
Private Sub frmProblema02_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim angulosexagesimal As Double = CDbl(InputBox("Ingrese un ngulo en grados
sexagesimales: ", "Razones trigonomtricas"))
Dim anguloradial As Double = (angulosexagesimal * Math.PI) / 180
Dim seno As Double = Math.Sin(anguloradial)
Dim coseno As Double = Math.Cos(anguloradial)
Dim Tangente As Double = Math.Tan(anguloradial)
Dim mensaje As String = "Las razones trigonomtricas del ngulo son:" & vbNewL
ine & vbNewLine & "Seno : " & Format(seno, "0.0000") & vbNewLine & "Coseno : " &
Format(coseno, "0.0000") & vbNewLine & "Tangente : " & Format(tangente, "0.0000
")
MessageBox.Show(mensaje)
End Sub
End Class
Problema 03:

Option Explicit On
Option Strict On
Public Class frmProblema03
Private Sub frmProblema03_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim telefono As String = InputBox("Ingrese el nmero telefnico al cual dese
a llamar: ", "Nmero telefnico")
Dim minutos As Double = CDbl(InputBox("Ingrese nmero de minutos consumido
s: ", "Tiempo de consumo"))
Dim basico As Double = 48.0
Dim costoMinuto As Double = 0.3
Dim consumo As Double = (minutos * costoMinuto)
Dim totalSinIgv As Double = consumo + basico
Dim igv As Double = 0.19 * totalSinIgv
Dim total As Double = totalSinIgv + igv
Dim mensaje As String = "Su consumo telefnico es:" & vbNewLine & vbNewLin
e & "Renta Bsica: S/. " & Format(basico, "0.00") & vbNewLine & vbNewLine & "Consu
mo llamadas: " & vbNewLine & Format(minutos, "00") & " minutos llamados al nmero
" & telefono & " : S/. " & Format(consumo, "0.00") & vbNewLine & vbNewLine & "Su
b Total: S/. " & Format(totalSinIgv, "0.00") & vbNewLine & vbNewLine & "IGV 19%:
S/. " & Format(igv, "0.00") & vbNewLine & vbNewLine & "Total: S/. " & Format(to
tal, "0.00")
MessageBox.Show(mensaje)
End Sub
End Class

Problema 04:
Option Explicit On
Option Strict On
Public Class frmProblema04
Private Sub frmProblema04_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim usuario As String = InputBox("Ingrese nombre de usuario: ", "Usuario
")
Dim KWHConsMes As Double = CDbl(val(InputBox("Ingrese la lectura de Kilo
watts-Hora KWH del presente mes: ", "Lectura del presente mes")))
Dim KWHConsAlMesAnterior As Double = CDbl(val(InputBox("Ingrese la lectu
ra de Kilowatts-Hora KWH del mes anterior: ", "Lectura del mes anterior")))
Dim consumo As Double = KWHConsMes - KWHConsAlMesAnterior
Dim tarifa As Double = 0.03
Dim importe As Double = consumo * tarifa
Dim alumbrado As Double = importe * 0.035
Dim mantenimiento As Double = importe * 0.018
Dim reajuste As Double = importe * 0.045
Dim igv As Double = importe * 0.19
Dim total As Double = importe + alumbrado + mantenimiento + reajuste + i
gv
Dim mensaje As String = "Cliente: " & usuario & vbNewLine & vbNewLine &
"Consumo: " & Format(consumo, "0.00") & " KWH" & vbNewLine & "Importe: S/. " & F
ormat(importe, "0.00") & vbNewLine & "Alumbrado Pblico: S/. " & Format(alumbrado,
"0.00") & vbNewLine & "Mantenimiento: S/. " & Format(mantenimiento, "0.00") & v

bNewLine & "Reajuste: S/. " & Format(reajuste, "0.00") & vbNewLine & "IGV 19% :
S/. " & Format(igv, "0.00") & vbNewLine & vbNewLine & "Monto total a pagar: S/.
" & Format(total, "0.00")
MessageBox.Show(mensaje)
End Sub
End Class

Problema 05:
Option Explicit On
Option Strict On
Public Class frmProblema05
Private Sub frmProblema05_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim galonesRecipiente1 As Double = CDbl(Val(InputBox("Ingrese la cantida
d de galones almacenados en el recipiente 1: ", "Clculo de combustible almacenado
")))
Dim piesCubicosRecipiente2 As Double = CDbl(Val(InputBox("Ingrese la can
tidad de pies cbicos almacenados en el recipiente 2: ", "Clculo de combustible alm
acenado")))
Dim litrosRecipiente3 As Double = CDbl(Val(InputBox("Ingrese la cantidad
de litros almacenados en el recipiente 3: ", "Clculo de combustible almacenado")
))
Dim litrosRecipiente1 As Double = galonesRecipiente1 * 3.79
Dim litrosRecipiente2 As Double = piesCubicosRecipiente2 * 0.0283
Dim total As Double = litrosRecipiente1 + litrosRecipiente2 + litrosReci
piente3
Dim mensaje As String = "El total de litros almacenados es: " & Format(t
otal, "0.000")
MessageBox.Show(mensaje)
End Sub
End Class

Problema 06:
Option Explicit On
Option Strict On
Public Class frmProblema06
Private Sub frmProblema06_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim catetoAdyacente As Double = CDbl(Val(InputBox("Ingrese la longitud d
el cateto adyacente: ", "Clculo de triangulo rectngulo")))
Dim catetoOpuesto As Double = CDbl(Val(InputBox("Ingrese la longitud del
cateto opuesto: ", "Clculo de triangulo rectngulo")))
Dim hipotenusa As Double = Math.sqr(Math.pow(catetoAdyacente) + Math.Pow
(catetoOpuesto))
Dim tangente1 As Double = catetoOpuesto/catetoAdyacente
Dim angulo1 As Double = (Math.Atan(tangente1)*180)/Math.PI
Dim tangente2 As Double = catetoAdyacente/catetoOpuesto
Dim angulo2 As Double = (Math.Atan(tangente2)*180)/Math.PI
Dim mensaje As String = "La hipotenusa del tringulo mide: " & Format(tota
l, "0.00") & " unidades." & vbNewLine & "El primer ngulo agudo es: " Format(angul

o1,"0.000") & vbNewLine & "El segundo ngulo agudo es: " Format(angulo2,"0.000")
MessageBox.Show(mensaje)
End Sub
End Class

Laboratorio 3
Problema 01:
Option Explicit On
Option Strict On
Public Class frmProblema01
Private Sub frmProblema01_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numeroA As Double = CDbl(Val(InputBox("Ingrese el valor del nmero A:"
, "Intercambio de nmeros")))
Dim numeroB As Double = CDbl(Val(InputBox("Ingrese el valor del nmero B:"
, "Intercambio de nmeros")))
Dim mensaje As String = "El valor del nmero A es : " & Format(numeroA) &
vbNewLine & "El valor del nmero B es : " & Format(numeroB) & vbNewLIne & "Los val
ores finales de los nmeros son:"
If numeroA > numeroB Then
Dim numeroC As Double = numeroA
numeroA = numeroB
numeroB = numeroC
End If
mensaje &= vbNewLine & "A = " & Format(numeroA) & " B = " & Format(numer
oB)
MessageBox.Show(mensaje)
End Sub
End Class

Problema 02:
Option Explicit On
Option Strict On
Public Class frmProblema02
Private Sub frmProblema02_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numeroA As Double = CDbl(Val(InputBox("Ingrese el primer nmero entero
:", "Mnimo y mximo de tres nmeros enteros")))
Dim numeroB As Double = CDbl(Val(InputBox("Ingrese el segundo nmero enter
o:", "Mnimo y mximo de tres nmeros enteros")))
Dim numeroC As Double = CDbl(Val(InputBox("Ingrese el tercer nmero entero
:", "Mnimo y mximo de tres nmeros enteros")))
Dim numeroMin As Double = numeroA
Dim numeroMax As Double = numeroA
Dim mensaje As String = "Los nmeros ingresados son: " & Format(numeroA) &
" " & Format(numeroB) & " " & Format(numeroC) & vbNewLine & vbNewLine
If numeroA > numeroB And numeroA > numeroc Then numeroMax = numeroA

If numeroB > numeroA And numeroB


If numeroC > numeroA And numeroC
If numeroA < numeroB And numeroA
If numeroB < numeroA And numeroB
If numeroC < numeroA And numeroC
mensaje &= "El valor mximo es :
es: " & Format(numeroMin)
MessageBox.Show(mensaje)
End Sub
End Class

>
>
<
<
<
"

numeroc Then numeroMax = numeroB


numeroB Then numeroMax = numeroC
numeroC Then numeroMin = numeroA
numeroC Then numeroMin = numeroB
numeroB Then numeroMin = numeroC
& Format(numeroMax) & " y el valor mnimo

Problema 03:
Option Explicit On
Option Strict On
Public Class frmProblema03
Private Sub frmProblema03_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numeroA As Double = CDbl(Val(InputBox("Ingrese el valor del primer nm
ero:", "Orden descendente de dos nmeros")))
Dim numeroB As Double = CDbl(Val(InputBox("Ingrese el valor del segundo
nmero:", "Orden descendente de dos nmeros")))
Dim mensaje As String = "Los nmeros ingresados son: " & Format(numeroA) &
" " & Format(numeroB) & " " & Format(numeroC) & vbNewLine & vbNewLine
If numeroA < numeroB Then
Dim numeroC As Double = numeroA
numeroA = numeroB
numeroB = numeroC
End If
mensaje &= "Los nmeros en orden descendente son: " & Format(numeroA) & "
B = " & Format(numeroB)
MessageBox.Show(mensaje)
End Sub
End Class
Problema 04:
Option Explicit On
Option Strict On
Public Class frmProblema04
Private Sub frmProblema04_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numeroA As Double = CDbl(Val(InputBox("Ingrese el primer nmero entero
:", "Orden Ascendente de tres nmeros enteros")))
Dim numeroB As Double = CDbl(Val(InputBox("Ingrese el segundo nmero enter
o:", "Orden Ascendente de tres nmeros enteros")))
Dim numeroC As Double = CDbl(Val(InputBox("Ingrese el tercer nmero entero
:", "Orden Ascendente de tres nmeros enteros")))
Dim numero1 As Double = numeroA
Dim numero2 As Double = numeroA
Dim numero3 As Double = numeroA
Dim mensaje As String = "Los nmeros ingresados son: " & Format(numeroA) &

" " & Format(numeroB) & " " & Format(numeroC) & vbNewLine & vbNewLine
If numeroA <= numeroB And numeroA <= numeroC Then
numero1 = numeroA
If numeroB <= numeroC Then
numero2 = numeroB
numero3 = numeroC
Else
numero2 = numeroC
numero3 = numeroB
End If
End If
If numeroB <= numeroA And numeroB <= numeroC Then
numero1 = numeroB
If numeroA <= numeroC Then
numero2 = numeroA
numero3 = numeroC
Else
numero2 = numeroC
numero3 = numeroA
End If
End If
If numeroC <= numeroA And numeroC <= numeroB Then
numero1 = numeroC
If numeroA <= numeroB Then
numero2 = numeroA
numero3 = numeroB
Else
numero2 = numeroB
numero3 = numeroA
End If
End If
mensaje &= "Los nmeros en orden descendentes son: " & Format(numero1) & "
- " & Format(numero2) & " - " & Format(numero3)
MessageBox.Show(mensaje)
End Sub
End Class
Problema 05:
Option Explicit On
Option Strict On
Public Class frmProblema05
Private Sub frmProblema05_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim coeficienteA As Double = CDbl(Val(InputBox("Ingrese el coeficiente A
de la ecuacin:", "Resolucin de ecuacin cuadrtica")))
Dim coeficienteB As Double = CDbl(Val(InputBox("Ingrese el coeficiente B
de la ecuacin:", "Resolucin de ecuacin cuadrtica")))
Dim coeficienteC As Double = CDbl(Val(InputBox("Ingrese el coeficiente C
de la ecuacin:", "Resolucin de ecuacin cuadrtica")))
Dim discriminante As Double = Math.Pow(coeficienteB, 2) - (4 * coeficien
teA * coeficienteC)
Dim raizCuadratica As Double = -coeficienteB / (2 * coeficienteA)
Dim mensaje As String = "La ecuacin cuadrtica: " & coeficienteA & "X" & iif
(coeficienteB >= 0, " + ", " ").tostring & coeficienteB & "X" & iif(coeficienteC
>= 0, " + ", " ").tostring & coeficienteC & vbNewLine & vbNewLine

Select discriminante
Case 0 : mensaje &= "Tiene una nica raz = " & raizCuadratica
Case Is > 0 : Dim conjugado As Double = Math.sqrt(discriminante) / (
2 * coeficienteA)
Dim raiz1 As Double = raizCuadratica + conjugado
Dim raiz2 As Double = raizCuadratica - conjugado
mensaje &= "Tiene dos races: x1= " & raiz1 & " y x2= " & raiz2
Case Is < 0 : Dim conjugado As Double = Math.sqrt(discriminante * -1
) / (2 * coeficienteA)
mensaje &= "Tiene dos races complejas: x1 = " & raizCuadratica &
" + i" & Format(conjugado, "0.000") & " y x2 = " & raizCuadratica & " - i" & For
mat(conjugado, "0.000")
End Select
MessageBox.Show(mensaje)
End Sub
End Class

Problema 06:
Option Explicit On
Option Strict On
Public Class frmProblema06
Private Sub frmProblema06_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim anguloSexagesimal As Integer = CInt(Val(InputBox("Ingrese el angulo
en grados sexagesimales:", "Determinacin del cuadrante de un ngulo")))
Dim mensaje As String = "El ngulo " & Format(anguloSexagesimal) & " "
If (anguloSexagesimal Mod 90) = 0 Then
mensaje &= "no pertenece a ningun cuadrante."
Else
Dim cuadrante As Integer = (anguloSexagesimal \ 90) Mod 4
If anguloSexagesimal > 0 Then
cuadrante += 1
Else
cuadrante -= 1
End If
mensaje &= "pertenece al cuadrante "
Select Case cuadrante
Case 1, -4 : mensaje &= " I."
Case 2, -3 : mensaje &= " II."
Case 3, -2 : mensaje &= " III."
Case 4, -1 : mensaje &= " IV."
End Select
End If
MessageBox.Show(mensaje)
End Sub
End Class
Problema 07:
Option Explicit On
Option Strict On
Public Class frmProblema07

Private Sub frmProblema07_Load(ByVal sender As System.Object, ByVal e As Sys


tem.EventArgs) Handles MyBase.Load
Dim kilometros As Double = CDbl(Val(InputBox("Ingrese el nmero de kilomet
ros recorridos: ", "Alquiler de vehculos")))
Dim montoFijo As Double = 30.0
Dim exceso1 As Double = 0.15
Dim exceso2 As Double = 0.1
Dim limite1 As Double = 300.0
Dim limite2 As Double = 1000.0
Dim montoTotal As Double = 0.0
Dim mensaje As String = "El recorrido del vehculo es de " & Format(kilome
tros, "0.00") & " Km. " & vbNewLine & vbNewLine
Select Case Kilometros
Case Is < limite1 : montoTotal = montoFijo
Case limite1 To limite2 : montoTotal = montoFijo + ((kilometros - li
mite1) * exceso1)
Case Is > limite2 : montoTotal = montoFijo + ((kilometros - limite1)
* exceso1) + ((kilometros - limite2) * exceso2)
End Select
Dim igv As Double = 0.19
Dim montoIgv = (montoTotal * igv) / (1 + igv)
mensaje &= "El monto a pagar es: S/. " & Format(montoTotal, "0.00") & "
(impuesto IGV " & Format(igv, "0%") & " = S/. " & Format(montoIgv, "0.00") & ")"
MessageBox.Show(mensaje)
End Sub
End Class
Problema 08:
Option Explicit On
Option Strict On
Public Class frmProblema08
Private Sub frmProblema08_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim horas As Double = CDbl(Val(InputBox("Ingrese el nmero de horas de est
acionamiento: ", "Estacionamiento de vehculos")))
Dim minutos As Double = CDbl(Val(InputBox("Ingrese el nmero de minutos de
estacionamiento: ", "Estacionamiento de vehculos")))
Dim tarifa As Double = 2.5
Dim montoTotal As Double = horas * tarifa
If minutos > 0 Then
minutos = Math.Round(minutos, 0)
Dim fraccion As Double = Math.Round(minutos / 60, 0)
If fraccion < minutos / 60 Then fraccion += 1
montoTotal += fraccion * tarifa
End If
Dim mensaje As String = "El monto total a pagar por el estacionamiento e
s: S/. " & Format(montoTotal, "0.00")
MessageBox.Show(mensaje)
End Sub
End Class
Problema 09:

Option Explicit On
Option Strict On
Public Class frmProblema09
Private Sub frmProblema09_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim dia As Integer = CInt(Val(InputBox("Ingrese el da: ", "Fecha de Nacim
iento")))
Dim mes As Integer = CInt(Val(InputBox("Ingrese el mes: ", "Fecha de Nac
imiento")))
Dim signo As String = ""
Select Case mes
Case 1 : If dia < 21 Then
signo = "Capricornio"
Else
signo = "Acuario"
End If
Case 2 : If dia < 20 Then
signo = "Acuario"
Else
signo = "Piscis"
End If
Case 3 : If dia < 21 Then
signo = "Piscis"
Else
signo = "Aries"
End If
Case 4 : If dia < 21 Then
signo = "Aries"
Else
signo = "Tauro"
End If
Case 5 : If dia < 22 Then
signo = "Tauro"
Else
signo = "Geminis"
End If
Case 6 : If dia < 22 Then
signo = "Geminis"
Else
signo = "Cancer"
End If
Case 7 : If dia < 23 Then
signo = "Cancer"
Else
signo = "Leo"
End If
Case 8 : If dia < 23 Then
signo = "Leo"
Else
signo = "Virgo"
End If
Case 9 : If dia < 23 Then
signo = "Virgo"
Else
signo = "Libra"
End If
Case 10 : If dia < 23 Then
signo = "Libra"

Else
signo = "Escorpio"
End If
Case 11 : If dia < 23 Then
signo = "Escorpio"
Else
signo = "Sagitario"
End If
Case 12 : If dia < 22 Then
signo = "Sagitario"
Else
signo = "Capricornio"
End If
End Select
Dim mensaje As String = "Su signo zodiacal segn su fecha de nacimiento es
: " & signo
MessageBox.Show(mensaje)
End Sub
End Class

Problema 10:
Option Explicit On
Option Strict On
Public Class frmProblema10
Private Sub frmProblema10_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim nota1 As Double = CDbl(Val(InputBox("Ingrese la nota de la primera e
valuacin calificada: ", "Evaluacin de Curso")))
Dim nota2 As Double = CDbl(Val(InputBox("Ingrese la nota de la segunda e
valuacin calificada: ", "Evaluacin de Curso")))
Dim nota3 As Double = CDbl(Val(InputBox("Ingrese la nota de la tercera e
valuacin calificada: ", "Evaluacin de Curso")))
Dim nota4 As Double = CDbl(Val(InputBox("Ingrese la nota de la cuarta ev
aluacin calificada: ", "Evaluacin de Curso")))
Dim mensaje As String = "Las notas del curso son: " & vbNewLine & vbNewL
ine & nota1 & vbNewLine & nota2 & vbNewLine & nota3 & vbNewLine & nota4 & vbNewL
ine & vbNewLine
Dim totalParcial As Double = nota1 + nota2 + nota3 + nota4
Dim notaMenor As Double = 0.0
If nota1 <= nota2 And nota1 <= nota3 And nota1 <= nota4 Then notaMenor =
nota1
If nota2 <= nota1 And nota2 <= nota3 And nota2 <= nota4 Then notaMenor =
nota2
If nota3 <= nota1 And nota3 <= nota2 And nota3 <= nota4 Then notaMenor =
nota3
If nota4 <= nota1 And nota4 <= nota2 And nota4 <= nota3 Then notaMenor =
nota4
mensaje &= "La nota ms baja es: " & notaMenor & vbNewLine & vbNewLine
Dim Promedio = Math.Round((totalParcial - notaMenor) / 3, 0)
mensaje &= "El promedio de las tres notas ms altas es : " & Format(Promed
io, "0")
MessageBox.Show(mensaje)
End Sub
End Class

Problema 11:
Option Explicit On
Option Strict On
Public Class frmProblema11
Private Sub frmProblema11_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim notaVigesimal As Integer = CInt(Val(InputBox("Ingrese la nota en sis
tema vigesimal (0 - 20): ", "Conversin de notas")))
Dim mensaje As String = "La nota " & notaVigesimal & " equivale a "
Dim notaLiteral As String = ""
Select Case notaVigesimal
Case 0 To 10 : notaLiteral = "F"
Case 11 : notaLiteral = "D"
Case 12 To 14 : notaLiteral = "C"
Case 15 To 16 : notaLiteral = "B"
Case 17 To 20 : notaLiteral = "A"
End Select
mensaje &= notaLiteral
MessageBox.Show(mensaje)
End Sub
End Class
Problema 12:
Option Explicit On
Option Strict On
Public Class frmProblema12
Private Sub frmProblema12_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim cantidad As Double = CInt(Val(InputBox("Ingrese la cantidad de unida
des a producir: ", "Clculo de costos de produccin")))
Dim producto As String = InputBox("Ingrese el tipo de producto a produci
r (A, B o C): ", "Clculo de costos de produccin")
Dim costoVariableA As Double = 3.5
Dim costoFijoA1 As Double = 500.0
Dim costoFijoA2 As Double = 700.0
Dim limiteA As Double = 100.0
Dim costoVariableB As Double = 2.5
Dim costoFijoB As Double = 600.0
Dim costoVariableC As Double = 9.0
Dim costoFijoC As Double = 450.0
Dim costoLote As Double = 0.0
Select Case producto
Case "A" : If cantidad <= limiteA Then
costoLote = costoFijoA1 + (costoVariableA * cantidad)
Else
costoLote = costoFijoA2 + (costoVariableA * cantidad)
End If
Case "B" : costolote = costoFijoB + (costoVariableB * cantidad)
Case "C" : costoLote = costoFijoC + (costoVariableC * cantidad)
End Select
Dim mensaje As String = "El costo total de produccin del lote es: S/. " &

Format(costolote, "0.00")
MessageBox.Show(mensaje)
End Sub
End Class
Problema 13:
Option Explicit On
Option Strict On
Public Class frmProblema13
Private Sub frmProblema13_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim ingresoAnual As Double = CDbl(Val(InputBox("Ingrese el monto total d
e su ingreso anual: S/. ", "Impuesto a la Renta")))
Dim impuesto As Double = 0.0
Dim minimo As Double = 0.0
Dim limite1 As Double = 20000.0
Dim limite2 As Double = 30000.0
Dim tasa1 As Double = 0.08
Dim tasa2 As Double = 0.1
Dim tasa3 As Double = 0.12
Dim fijo1 As Double = 1600.0
Dim fijo2 As Double = 2600.0
Dim mensaje As String = ""
If ingresoAnual > minimo And ingresoAnual <= limite1 Then impuesto = ing
resoAnual * tasa1
If ingresoAnual > limite1 And ingresoAnual <= limite2 Then impuesto = fi
jo1 + ((ingresoAnual - limite1) * tasa2)
If ingresoAnual > limite2 Then impuesto = fijo2 + ((ingresoAnual - limit
e2) * tasa3)
If ingresoAnual > minimo Then
mensaje = "El importe total a pagar por concepto de Impuesto a la Re
nta es: S/. " & Format(impuesto, "0.00")
Else
mensaje = "No se paga impuesto segn el monto total de su ingreso anua
l"
End If
MessageBox.Show(mensaje)
End Sub
End Class

Laboratorio 04
Problema 04
Option Explicit On
Option Strict On
Public Class frmProblema04
Private Sub frmProblema04_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim fibbonacci1 As Integer = 0
Dim fibbonacci2 As Integer = 1

Dim sumaFibbonacci As Integer = fibbonacci1 + fibbonacci2


Dim limite As Integer = 100
Dim mensaje As String = "Los nmeros de la serie de Fibbonacci menores que
" & limite & " son:" & vbNewLine & vbNewLine
Do While (Fibbonacci2 < limite)
mensaje &= Fibbonacci2
sumaFibbonacci = fibbonacci1 + fibbonacci2
fibbonacci1 = fibbonacci2
fibbonacci2 = sumaFibbonacci
If fibbonacci2 < limite Then mensaje &= ", "
Loop
MessageBox.Show(mensaje)
End Sub
End Class
Problema 05
Option Explicit On
Option Strict On
Public Class frmProblema05
Private Sub frmProblema05_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim N As Integer = CInt(Val(InputBox("Ingrese N: ", "Nmeros perfectos ent
re 1 y N")))
Dim hayPerfectos As Boolean = False
Dim sumaDivisores As Integer
Dim numerosPerfectos As String = ""
Dim mensaje As String = ""
For numero = 1 To N
sumaDivisores = 0
For divisor = 1 To (numero - 1)
If numero Mod Divisor = 0 Then sumaDivisores += divisor
Next
If sumaDivisores = numero Then
numerosPerfectos &= numero & " "
hayPerfectos = True
End If
Next
If hayPerfectos Then
mensaje = "Los nmeros perfectos entre 1 y " & N & " son: " & numerosP
erfectos
Else
mensaje = "No hay nmeros perfectos entre 1 y " & N
End If
MessageBox.Show(mensaje)
End Sub
End Class

Problema 06
Option Explicit On
Option Strict On
Public Class frmProblema06

Private Sub frmProblema06_Load(ByVal sender As System.Object, ByVal e As Sys


tem.EventArgs) Handles MyBase.Load
Dim limiteInferior As Double = 0.0
Dim limiteSuperior As Double = 10.0
Dim x As Double = limiteInferior
Dim incremento As Double = 0.5
Dim fx As Double
Dim mensaje As String = "La resolucin de la ecuacin: f(x) = X + X - 5 para l
os valores de X de " & limiteInferior & " a " & limiteSuperior & " con un increm
ento de " & Format(incremento, "0.0") & "es : " & vbNewLine & vbNewLine
For x = limiteInferior To LimiteSuperior Step incremento
fx = Math.Pow(x, 3) + Math.Pow(x, 2) - 5
mensaje &= "x = " & Format(x, "0.0") & " f(x) = " & Format(fx, "0.00
0") & vbNewLine
Next
MessageBox.Show(mensaje)
End Sub
End Class
Problema 07
Option Explicit On
Option Strict On
Public Class frmProblema07
Private Sub frmProblema07_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numerador As Integer
Dim denominador As Integer
Dim sumaNumerador As Integer = 0
Dim sumaDenominador As Integer = 1
Dim limiteSuperior As Integer = 15
Dim mensaje As String = "Los primeros " & limiteSuperior & " elementos d
e la serie son: " & vbNewLine & vbNewLine
For i = 1 To limiteSuperior
denominador = 1
For j = 1 To i
denominador *= 2
Next
numerador = denominador - 1
mensaje &= numerador & "/" & denominador
If i < limiteSuperior Then mensaje &= " + "
sumaNumerador = ((denominador \ sumaDenominador) * sumaNumerador) +
numerador
sumaDenominador = denominador
Next
mensaje &= vbNewLine & vbNewLine & "La suma de la serie es : " & sumaNum
erador & "/" & sumaDenominador
MessageBox.Show(mensaje)
End Sub
End Class
Problema 08
Option Explicit On
Option Strict On

Public Class frmProblema08


Private Sub frmProblema08_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numero As Integer
Dim numeroBuscado As Integer = 0
Dim sumaDigitos As Integer = 0
Dim c As Integer
Dim d As Integer
Dim u As Integer
Dim suma As Integer
Dim limiteSuperior As Integer = 10
Dim numerosIngresados As String = ""
For i = 1 To limiteSuperior
numero = CInt(Val(InputBox("Ingrese el " & i & " nmero entre 100 y 999
: ", "Mayor suma de dgitos de 10 nmeros")))
numerosIngresados &= numero & vbNewLine
c = numero \ 100
d = (numero - (c * 100)) \ 10
u = numero Mod 10
suma = c + d + u
If suma > sumaDigitos Then
sumaDigitos = suma
numeroBuscado = numero
End If
Next
Dim mensaje As String = "Los nmeros ingresados son:" & vbNewLine & vbNewL
ine & numerosIngresados & vbNewLine & "El nmero con la ms alta suma de dgitos es :
" & numeroBuscado & " con una suma de dgitos igual a : " & sumaDigitos
MessageBox.Show(mensaje)
End Sub
End Class

Problema 09
Option Explicit On
Option Strict On
Public Class frmProblema09
Private Sub frmProblema09_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim N As Integer = CInt(Val(InputBox("Ingrese el nmero de das de entrenami
ento: ", "Entrenamiento en mquina caminadora")))
Dim calorias As Double
Dim kilometros As Double
Dim velocidad As Double
Dim totalCalorias As Double = 0.0
Dim sumaVelocidad As Double = 0.0
Dim PromedioVelocidad As Double = 0.0
Dim maximoKilometros As Double = 0.0
Dim maximoDia As Integer = 0
Dim resumen As String = "Dia Calorias Quemadas Kilometros caminados V
elocidad de carrera" & vbNewLine
For i = 1 To N
calorias = CDbl(Val(InputBox("Ingrese el nmero calorias quemadas el da
" & i & " de entrenamiento: ", "Entrenamiento en mquina caminadora. Da " & N)))

kilometros = CDbl(Val(InputBox("Ingrese el nmero kilometros caminados


el da " & i & " de entrenamiento: ", "Entrenamiento en mquina caminadora. Da " & N
)))
velocidad = CDbl(Val(InputBox("Ingrese la velocidad de carrera del da
" & i & " de entrenamiento: ", "Entrenamiento en mquina caminadora. Da " & N)))
resumen &= i & " " & calorias & " " & kilometros & " " & veloci
dad & vbNewLine
TotalCalorias += calorias
sumaVelocidad += velocidad
If kilometros > maximoKilometros Then
maximoKilometros = kilometros
maximoDia = i
End If
Next
PromedioVelocidad = sumaVelocidad / N
Dim mensaje As String = "Los resultados de su entrenamiento son:" & vbNe
wLine & vbNewLine & resumen & vbNewLine & "1.- El total de calorias quemadas es
de: " & totalCalorias & vbNewLine & "2.- El promedio de velocidad de entrenamien
to es de: " & PromedioVelocidad & " Km/h" & vbNewLine & "3.- El da " & maximoDia
& " se logr el mximo de " & maximoKilometros & " kilometros recorridos."
MessageBox.Show(mensaje)
End Sub
End Class

Laboratorio 05
Problema 02
Option Explicit On
Option Strict On
Public Class frmProblema02
Private Sub frmProblema02_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim ingresarPaquetes As Boolean = True
Dim numeroPaquete As Integer = 1
Dim capacidadCamion As Double = 20.0
Dim volumen As Double = 0.0
Dim totalVolumen As Double = 0.0
Dim VolumenCargado As Double = 0.0
Dim numeroCamiones As Integer = 0
Dim respuesta As Integer = 1
Dim resumen As String = "Paquete Volumen en metros cbicos" & vbNewLine
Dim paquetesNoCargados As Integer = 0
Do While ingresarPaquetes
volumen = CDbl(Val(InputBox("Ingrese el volumen en metros cbicos del
paquete " & numeroPaquete & ": ", "Carga de camiones")))
resumen &= numeroPaquete & "
" & volumen & vbNewLine
If volumen > capacidadCamion Then
paquetesNoCargados += 1
Else
totalVolumen += volumen
volumenCargado += volumen
If volumenCargado >= capacidadCamion Then
numeroCamiones += 1
If volumenCargado = capacidadCamion Then
VolumenCargado = 0

Else
volumenCargado = volumen
End If
End If
End If
respuesta = CInt(Val(InputBox("Desea seguir registrando paquetes para
carga?" & vbNewLine & vbNewLine & "1.- S
2.- No", "Carga de camiones")))
If respuesta <> 1 Then ingresarPaquetes = False
numeroPaquete += 1
Loop
If VolumenCargado > 0 Then numeroCamiones += 1
Dim mensaje As String = "El registro de paquetes es: " & vbNewLine & vbN
ewLine & resumen
mensaje &= vbNewLine & "1.- Cantidad total de camiones empleados: " & nu
meroCamiones & vbNewLine & "2.- Volumen total de paquetes cargados: " & totalVol
umen & vbNewline
If paquetesNoCargados > 0 Then mensaje &= "3.- No se cargaron " & paquet
esNoCargados & " por superar cada uno la capacida mxima de " & Format(capacidadCa
mion, "0") & " metros cbicos de los camiones"
MessageBox.Show(mensaje)
End Sub
End Class

Problema 03
Option Explicit On
Option Strict On
Public Class frmProblema03
Private Sub frmProblema03_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim N As Integer = CInt(Val(InputBox("Ingrese un nmero entero: ", "Factor
es primos de un nmero N")))
Dim divisor As Integer = 2
Dim factorizado As Integer = N
Dim esPrimo As Boolean
Dim mensaje As String = "Los factores primos de " & N & " son:" & vbNewL
ine & vbNewLine & "1" & vbNewLine
Do While (divisor <= factorizado)
esPrimo = True
For i = 2 To (divisor - 1)
If divisor Mod i = 0 Then esPrimo = False
Next
If esPrimo Then
If N Mod divisor = 0 Then
Do While (factorizado Mod divisor = 0) And (factorizado > 1)
factorizado \= divisor
Loop
mensaje &= divisor & vbNewLine
End If
End If
divisor += 1
Loop
MessageBox.Show(mensaje)
End Sub

End Class

Problema 04
Option Explicit On
Option Strict On
Public Class frmProblema04
Private Sub frmProblema04_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim numeroCuenta As String = InputBox("Ingrese el nmero de cuenta corrien
te:", "Registro de Transacciones")
Dim saldoInicial As Double = CDbl(Val(InputBox("Ingrese el saldo inicial
de la cuenta " & numeroCuenta & ": S/.", "Registro de Transacciones")))
Dim tipoTransaccion As String = ""
Dim SaldoFinal As Double = saldoInicial
Dim mensaje As String = "Registro de transacciones del presente ao" & vbN
ewLine & vbNewLine & "Cuenta Nmero :" & numeroCuenta & vbNewLine & vbNewLine & "S
aldo Inicial : S/. " & Format(saldoInicial, "0.00") & vbNewLine & vbNewLine
Dim resumen As String = "Tipo de Operacin " & "Monto de la transaccin" & v
bNewLine
Dim monto As Double
Dim operacion As String = ""
Do While tipoTransaccion <> "X"
tipoTransaccion = InputBox("Ingrese el tipo de transaccin realizada:"
& vbNewLine & vbNewLine & "D : Deposito R : Retiro X : Finalizar ", "Transac
ciones de la cuenta " & numeroCuenta)
Select Case tipoTransaccion
Case "R" : operacion = "Retiro
"
Case "D" : operacion = "Depsito
"
End Select
If tipoTransaccion = "R" Or tipoTransaccion = "D" Then
monto = CDbl(Val(InputBox("Ingrese el monto del " & operacion &
": S/.", "Transacciones de la cuenta " & numeroCuenta)))
resumen &= operacion & "S/. " & Format(monto, "0.00") & vbNewLin
e
Select Case tipoTransaccion
Case "R" : SaldoFinal -= monto
Case "D" : SaldoFinal += monto
End Select
End If
Loop
mensaje &= resumen & vbNewLine & "Saldo Final : S/. " & Format(saldoFina
l, "0.00")
MessageBox.Show(mensaje)
End Sub
End Class
Problema 05
Option Explicit On
Option Strict On
Public Class frmProblema05

Private Sub frmProblema05_Load(ByVal sender As System.Object, ByVal e As Sys


tem.EventArgs) Handles MyBase.Load
Dim HA As Double = CDbl(Val(InputBox("Ingrese el nmero de habitantes de l
a ciudad A ", "Crecimiento poblacional")))
Dim HB As Double = CDbl(Val(InputBox("Ingrese el nmero de habitantes de l
a ciudad B ", "Crecimiento poblacional")))
Dim tasaA As Double = 0.03
Dim tasaB As Double = 0.02
Dim HAFinal As Double = HA
Dim HBFinal As Double = HB
Dim numeroAnios As Integer = 0
Dim resumen As String = "Ao Nro. Poblacin de A Poblacin de B" & vbNewLine
& "0
" & HA & "
" & HB & vbNeWLine
Do While HAFinal <= HBFinal
numeroAnios += 1
HAFinal *= (1 + tasaA)
HBFinal *= (1 + tasaB)
HAFinal = Math.Round(HAFinal, 0)
HBFinal = Math.Round(HBFinal, 0)
resumen &= numeroAnios & "
" & HAFinal & "
" &
HBFinal & vbNewLine
Loop
Dim mensaje As String = "El crecimiento poblacional de A y B es:" & vbNe
wLine & vbNewLine & resumen & vbNewLine & "Dentro de " & numeroAnios & " aos la p
oblacin de A ser mayor que la poblacin de B"
MessageBox.Show(mensaje)
End Sub
End Class

Problema 06
Option Explicit On
Option Strict On
Public Class frmProblema06
Private Sub frmProblema06_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim fibbonacci1 As Integer = 0
Dim fibbonacci2 As Integer = 1
Dim sumaFibbonacci As Integer = fibbonacci1 + fibbonacci2
Dim limite As Integer = 350
Dim mensaje As String = "Los nmeros de la serie de Fibbonacci menores que
" & limite & " son: " & vbNewLine & vbNewLine
Do While (Fibbonacci2 < limite)
mensaje &= Fibbonacci2
sumaFibbonacci = fibbonacci1 + fibbonacci2
fibbonacci1 = fibbonacci2
fibbonacci2 = sumaFibbonacci
If fibbonacci2 < limite Then mensaje &= ", "
Loop
MessageBox.Show(mensaje)
End Sub
End Class

Problema 07
Option Explicit On
Option Strict On
Public Class frmProblema07
Private Sub frmProblema07_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim fibbonacci1 As Integer = 0
Dim fibbonacci2 As Integer = 1
Dim sumaFibbonacci As Integer = fibbonacci1 + fibbonacci2
Dim numerosFibbonacci As Integer = 1
Dim numerosPedidos As Integer = 15
Dim mensaje As String = "Los " & numerosPedidos & " primeros nmeros de la
serie de Fibbonacci son: " & vbNewLine & vbNewLine
Do While (numerosFibbonacci <= numerosPedidos)
mensaje &= Fibbonacci2
sumaFibbonacci = fibbonacci1 + fibbonacci2
fibbonacci1 = fibbonacci2
fibbonacci2 = sumaFibbonacci
numerosFibbonacci += 1
If numerosFibbonacci <= numerosPedidos Then mensaje &= ", "
Loop
MessageBox.Show(mensaje)
End Sub
End Class
Problema 08
Option Explicit On
Option Strict On
Public Class frmProblema08
Private Sub frmProblema08_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim ingresarNotas As Integer = 1
Dim alumno As String = ""
Dim nota1 As Double
Dim nota2 As Double
Dim nota3 As Double
Dim nota4 As Double
Dim notaMenor As Double
Dim promedio As Double
Dim totalParcial As Double
Dim tareaPromedio As Double = 0.0
Dim totalTarea As Double = 0.0
Dim alumnosAprobados As Integer = 0
Dim resumen As String = "Alumno
Nota1 Nota2 Nota3 Nota4 Nota ms Ba
ja Promedio Tarea Acadmica" & vbNewLine
Dim numeroAlumno As Integer = 0
Dim alumnoTareaAlta As String = ""
Dim tareaMasAlta = 0.0
Do While ingresarNotas = 1
numeroAlumno += 1

alumno = InputBox("Ingrese el nombre del alumno: ", "Ingreso de Nota


s")
Do
nota1 = CDbl(Val(InputBox("Ingrese la primera nota del alumno: "
, "Alumno: " & alumno)))
If Not (nota1 >= 0 And nota1 <= 20) Then MessageBox.Show("Error:
Debe ingresar una nota entre 0 y 20")
Loop Until nota1 >= 0 And nota1 <= 20
Do
nota2 = CDbl(Val(InputBox("Ingrese la segunda nota del alumno: "
, "Alumno: " & alumno)))
If Not (nota2 >= 0 And nota2 <= 20) Then MessageBox.Show("Error:
Debe ingresar una nota entre 0 y 20")
Loop Until nota2 >= 0 And nota2 <= 20
Do
nota3 = CDbl(Val(InputBox("Ingrese la tercera nota del alumno: "
, "Alumno: " & alumno)))
If Not (nota3 >= 0 And nota3 <= 20) Then MessageBox.Show("Error:
Debe ingresar una nota entre 0 y 20")
Loop Until nota3 >= 0 And nota3 <= 20
Do
nota4 = CDbl(Val(InputBox("Ingrese la cuarta nota del alumno: ",
"Alumno: " & alumno)))
If Not (nota4 >= 0 And nota4 <= 20) Then MessageBox.Show("Error:
Debe ingresar una nota entre 0 y 20")
Loop Until nota4 >= 0 And nota4 <= 20
totalParcial = nota1 + nota2 + nota3 + nota4
notaMenor = 0.0
resumen &= alumno & "
" & Format(nota1, "0.00") & "
" & Forma
t(nota2, "0.00") & "
" & Format(nota3, "0.00") & "
" & Format(nota4, "0.00
")
If nota1 <= nota2 And nota1 <= nota3 And nota1 <= nota4 Then notaMen
or = nota1
If nota2 <= nota1 And nota2 <= nota3 And nota2 <= nota4 Then notaMen
or = nota2
If nota3 <= nota1 And nota3 <= nota2 And nota3 <= nota4 Then notaMen
or = nota3
If nota4 <= nota1 And nota4 <= nota2 And nota4 <= nota3 Then notaMen
or = nota4
promedio = Math.Round((totalParcial - notaMenor) / 3, 2)
If promedio > tareaMasAlta Then
tareaMasAlta = promedio
alumnoTareaAlta = alumno
End If
totalTarea += promedio
If promedio >= 11.0 Then alumnosAprobados += 1
resumen &= "
" & Format(notaMenor, "0.00") & "
" & Format(prom
edio, "0.00") & vbNewLine
ingresarNotas = CInt(Val(InputBox("Desea continuar ingresando notas?"
& vbNewLine & vbNewLine & "1.- S 2.- No", "Ingreso de Notas")))
Loop
tareaPromedio = Math.Round(totalTarea / numeroAlumno, 2)
Dim mensaje As String = "Reporte Acadmico:" & vbNewLine & vbNewLine & res
umen & vbNewLine & vbNewLine & "1.- Nmero de alumnos con tarea acadmica aprobada:
" & alumnosAprobados & vbNewLine & "2.-Tarea acadmica promedio : " & tareaPromedi
o & vbNewLine & "3.- Alumno con la Tarea Acadmica ms alta: " & alumnoTareaAlta
MessageBox.Show(mensaje)
End Sub
End Class

Problema 09
Option Explicit On
Option Strict On
Public Class frmProblema09
Private Sub frmProblema09_Load(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles MyBase.Load
Dim M As Double = CDbl(Val(InputBox("Ingrese el monto del prstamo: S/. ",
"Clculo de pagos de un prstamo")))
Dim N As Double = CDbl(Val(InputBox("Ingrese el nmero de meses para pagar
el prstamo: ", "Clculo de pagos de un prstamo")))
Dim R As Double = CDbl(Val(InputBox("Ingrese el inters mensual del prstamo
: % ", "Clculo de pagos de un prstamo")))
Dim resumen As String = "Mes Pago" & vbNewLine
Dim principal As Double = M / N
Dim deudaRestante As Double = M
Dim interesMensual As Double = R / 100
Dim pagoMensual As Double
For i = 1 To N
pagoMensual = principal + (deudaRestante * interesMensual)
deudaRestante -= principal
resumen &= i & "
S/. " & Format(pagoMensual, "0.00") & vbNewLine
Next
Dim mensaje As String = "El cronograma de pagos del prstamo es el siguien
te:" & vbNewLine & vbNewLine & "Monto del prstamo: S/. " & Format(M, "0.00") & vb
NewLine & "Nmero de meses: " & N & vbNewLine & "Inters mensual: " & Format(interes
Mensual, "0%") & vbNewLine & vbNewLine & resumen
MessageBox.Show(mensaje)
End Sub
End Class

Problema 10

You might also like