Está en la página 1de 5

Mdulo II

GUIA DE LABORATORIO #02 IV B


Semana 03 Mircoles 15 de Setiembre

Objetivos
Luego de completar este laboratorio, el estudiante ser capaz de:
Revisar las estructuras de programacin en .NET
Emplear cuadros de mensaje para la entrada y salida de datos

1. ESTRUCTURAS_CONDICIONALES
Module EjemploIfAnidadoNota
Sub main()
Dim nota!
Console.Write("Ingrese Nota:")
nota = Console.ReadLine
'--------If basico------------If nota <= 10.5 Then
Console.WriteLine("MAL")
ElseIf nota <= 15 Then
Console.WriteLine("Regular")
ElseIf nota >= 16 And nota <= 20 Then
Console.WriteLine("Bien")
Else
Console.WriteLine("No Jorgito esa nota no es valida")
End If
Console.ReadLine()
End Sub
End Module
Module EjemploIfCompuestoNota
Sub main()
Dim nota!
Console.WriteLine("Ingrese Nota ")
nota = Console.ReadLine()
'----Primera Forma---------If nota >= 10.5 Then
Console.WriteLine("Aprobado")
Else
Console.WriteLine("Desaprobado")
End If
'----Segunda Forma
If nota >= 10.5 Then _
Console.WriteLine("Aprobado") :
Console.WriteLine("Felicitaciones") _
UNIDAD DIDACTICA TALLER DE DESARROLLO DE SOFTWARE

Pg.# 1

PDF created with pdfFactory Pro trial version www.pdffactory.com

Lic. Gina Huertas Camacho

Mdulo II

Else Console.WriteLine("Desaprobado")
'----Tercera Forma
Dim mensaje$
mensaje = IIf(nota >= 10.5, "Aprobado", "Desaprobado")
Console.WriteLine(mensaje)
Console.ReadLine()
End Sub
End Module

Module EjemploIfEdad
Sub Main()
Dim edad%
Console.WriteLine("Ingrese Edad:")
edad = Console.ReadLine
'-----Primera Forma----------If edad >= 18 Then
Console.WriteLine("Eres mayor de Edad")
End If
'-----Segunda Forma----------If edad >= 18 Then Console.WriteLine("Eres mayor de Edad")
'-----Tercera Forma----------Dim mensaje$
mensaje = IIf(edad >= 18, "Eres mayor de edad", "")
Console.WriteLine(mensaje)
Console.ReadLine()
End Sub
End Module
Module EjemploIfSelect
Sub main()
Dim nombre$
Dim sueldo@
Dim area As Char
Console.WriteLine("Ingrese Nombre:")
nombre = Console.ReadLine
Console.Write("Ingrese Sueldo:")
sueldo = Console.ReadLine
sueldo = Val(sueldo)
Console.WriteLine("Ingrese Area:")
area = Console.ReadLine
area = UCase(area)
Select Case area
Case "A"
Dim incremento@
incremento = sueldo + (sueldo * 0.15)
If nombre = "luis" And incremento >= 100 Then
Dim mul%
mul = incremento * 5
If mul >= 500 And mul <= 1500 Then
Console.WriteLine("Proceso Realizado")
End If

UNIDAD DIDACTICA TALLER DE DESARROLLO DE SOFTWARE

Pg.# 2

PDF created with pdfFactory Pro trial version www.pdffactory.com

Lic. Gina Huertas Camacho

Mdulo II

End If
Case "B"
Dim decremento@
decremento = sueldo - (sueldo * 0.25)
If decremento >= 50 Then
Console.WriteLine("Transacin Realizado")
End If
Case "C"
If sueldo >= 800 And sueldo <= 2500 Then
Console.WriteLine("Sueldo si esta en el rango")
End If
Case Else
Console.WriteLine("Area no existe...!!!")
End Select
Console.ReadLine()
End Sub
End Module
Module PracticaIfAnidado
Sub main()
Dim nombre$
Dim sueldo@
Dim area As Char
Console.WriteLine("Ingrese Nombre:")
nombre = Console.ReadLine
Console.Write("Ingrese Sueldo:")
sueldo = Console.ReadLine
sueldo = Val(sueldo)
Console.WriteLine("Ingrese Area:")
area = Console.ReadLine
area = UCase(area)
If area = "A" Then
Dim incremento@
incremento = sueldo + (sueldo * 0.15)
If incremento >= 100 Then
Dim mul%
mul = incremento * 5
If mul >= 500 And mul <= 1500 Then
Console.WriteLine("Proceso Realizado")
End If
End If
ElseIf area = "B" Then
Dim decremento@
decremento = sueldo - (sueldo * 0.25)
If decremento >= 50 Then
Console.WriteLine("Transacin Realizado")
End If
ElseIf area = "C" Then
If sueldo >= 800 And sueldo <= 2500 Then
Console.WriteLine("Sueldo si esta en el rango")
End If
Else
Console.WriteLine("Area no existe...!!!")
End If
Console.ReadLine()
End Sub
End Module

UNIDAD DIDACTICA TALLER DE DESARROLLO DE SOFTWARE

Pg.# 3

PDF created with pdfFactory Pro trial version www.pdffactory.com

Lic. Gina Huertas Camacho

Mdulo II

2. Guia_message
Module Module1
Sub Main()
Dim nota!
'--------If anidado------------Console.Write("Ingrese Nota ")
nota = Console.ReadLine()
If nota <= 12 Then
MsgBox("MAL")
ElseIf nota <= 15 Then
MsgBox("Regular")
ElseIf nota >= 16 And nota <= 20 Then
MsgBox("Bien")
Else
MsgBox(" esa nota no es valida")
End If
'sintaxis simple de if
Dim mensaje$
mensaje = IIf(nota >= 13, " Aprobado", "Desaprobado")
MsgBox(mensaje)
End Sub
End Module
Module Module2
Sub main()
Dim texto As String
Console.Write("Ingrese Texto ")
texto = Console.ReadLine()
' MsgBox("Mensaje")
' MsgBox("Mensaje", 1)
MsgBox("Mensaje " + texto, 64, "Titulo")
End Sub
End Module
Module Module3
Sub main()
Dim x As Double
x = InputBox("Ingrese un numero", "Cuadrado")
x = x * x
MsgBox(x, , "el cuadrado es")
End Sub
End Module
Module Module_cuadrado
Sub main()
Dim x As Double
x = InputBox("Ingrese un numero", "Cuadrado")
x = x * x
MsgBox(x, , "el cuadrado es")
End Sub
End Module

UNIDAD DIDACTICA TALLER DE DESARROLLO DE SOFTWARE

Pg.# 4

PDF created with pdfFactory Pro trial version www.pdffactory.com

Lic. Gina Huertas Camacho

Mdulo II

Module tabla_multiplicar
Sub main()
Dim d, x As Integer
Dim m As String
d = InputBox("Ingrese Numero ", "Tabla Multiplicar")
For x = 1 To 12
m &= Str(x) & " * " + Str(d) _
& " = " & Str(x * d) & Chr(13)
Next
MsgBox(m, , "Tabla del " & d.ToString)
End Sub
End Module
Module mayor_menor
Sub main()
Dim x, d, men, may, sum As Integer
Dim rta As String
For x = 1 To 10
d = InputBox("dato")
If x = 1 Then
may = d
men = d
sum = d
Else
If d > may Then may = d
If d < men Then men = d
sum += d
End If
Next
rta = "Mayor : " & Str(may) & Chr(13) _
& "Menor " & Str(men) & Chr(13) _
& "suma " & Str(sum)
MsgBox(rta, MsgBoxStyle.Information, "Resupuesta : ")
End Sub
End Module

UNIDAD DIDACTICA TALLER DE DESARROLLO DE SOFTWARE

Pg.# 5

PDF created with pdfFactory Pro trial version www.pdffactory.com

Lic. Gina Huertas Camacho

También podría gustarte