



Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
Este documento contiene dos ejercicios de programación en visual basic. El primero es sobre una serie matemática, donde se pide calcular el valor de la serie a partir de los términos introducidos por el usuario. El segundo ejercicio es sobre el cálculo del volumen de una semiesfera hueca, donde se deben introducir los radios exterior e interior de la semiesfera. Ambos ejercicios incluyen la implementación del código en visual basic, con validaciones de los datos de entrada y cálculos de los resultados. El documento podría ser útil para estudiantes de cursos de programación en visual basic, tanto a nivel universitario como de educación secundaria, que buscan practicar y reforzar sus conocimientos en este lenguaje de programación.
Tipo: Apuntes
1 / 5
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!




Espinosa Miguel, parcial 1 total= 11,6 + 5,45 = 17, Pregunta 1 serie Public Class Form ' Serie ' Pseudocódigo (3) =2, ' abre por proyecto (0,25) =0, ' presentación (0,25) =0, ' dimensionar (1) = ' verificar numérico n (0,25) = 0, ' verificar n > 0 (0,25) =0, ' verificar haya escrito algo n (0,25) =0, ' verificar numérico H (0,25) =0, ' verificar H <> 0 (0,25) =0, ' verificar haya escrito algo H (0,25) =0, ' calcular (4) = ' muestra resultado (1) = ' borrar (0,75) =0, ' salir (0,25) =0, ' total (12) =11, ' Dim h , p , s1 , s2 As Single Dim fact1 , fact2 , n As Integer Private Sub Label1_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles Label1. Click End Sub Private Sub Form1_Load ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles MyBase. Load End Sub Private Sub btn_salir_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_salir. Click End End Sub Private Sub btn_borrar_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_borrar. Click txt_1. Clear () txt_2. Clear () 'lm_faltó el focus y borrar el resultado End Sub Private Sub txt_1_KeyPress ( ByVal sender As Object , ByVal e As System. Windows. Forms. KeyPressEventArgs ) Handles txt_1. KeyPress If InStr ( 1 , "0123456789" & Chr ( 8 ), e. KeyChar ) = 0 Then e. KeyChar = "" End If End Sub Private Sub txt_1_TextChanged ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles txt_1. TextChanged End Sub
Private Sub txt_2_KeyPress ( ByVal sender As Object , ByVal e As System. Windows. Forms. KeyPressEventArgs ) Handles txt_2. KeyPress If InStr ( 1 , "0123456789" & Chr ( 8 ), e. KeyChar ) = 0 Then 'lm_puede recibir negativos y decimales e. KeyChar = "" End If End Sub Private Sub txt_2_TextChanged ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles txt_2. TextChanged End Sub Private Sub btn_aceptar_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_aceptar. Click If Not IsNumeric ( txt_1. Text ) Then MsgBox ( "debe escribir un valor" ) txt_1. Focus () : Exit Sub End If If txt_1. Text = 0 Then MsgBox ( "el numero de terminos no debe ser cero" ) 'lm_acentos número, términos txt_1. Text = "" : txt_1. Focus () : Exit Sub Else n = txt_1. Text End If If Not IsNumeric ( txt_2. Text ) Then MsgBox ( "debe escribir un valor" ) txt_2. Focus () : Exit Sub End If If txt_2. Text = 0 Then MsgBox ( "el numero de terminos no debe ser cero" ) 'lm_es h txt_2. Text = "" : txt_2. Focus () : Exit Sub Else h = txt_2. Text End If End Sub Private Sub Btn_calcular_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles Btn_calcular. Click s1 = 0 For a = 0 To ( n - 1 ) 'numerador p = 1 For b = a To n fact1 = 1 If b = 0 Then fact1 = 1 Else fact1 = 1 For m = 1 To b fact1 = fact1 ***** m Next End If p = p *** (** h / fact1 ) Next 'denominador s2 = 0 For z = a To ( n - 1 )
Pregunta 2 volumen semiesfera hueca Public Class Form ' volumen SEMIESFERA hueca ' Pseudocódigo (1,5) = 0, ' abre por proyecto (0,25) = 0, ' presentación (0,25) = 0,2 'lm_unidades ' dimensionar (0,25) =0, ' verificar numérico re (0,25) =0, ' verificar re > 0 (0,25) = ' verificar haya escrito algo re (0,25) = ' verificar numérico ri (0,25) =0, ' verificar ri > 0 (0,25) = ' verificar haya escrito algo ri (0,25) = ' verificar re > ri (0,5)=0, ' calcular (3) = 3 ' muestra resultado (0,25) =0, ' borrar (0,25) = 0, ' salir (0,25) = 0, ' total (8) = 5, ' Dim V , RE , RI As Single Private Sub btn_salir_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_salir. Click End End Sub Private Sub btn_borrar_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_borrar. Click txt_1. Clear () txt_2. Clear () 'lm_faltó focus y borrar el resultado End Sub Private Sub Form1_Load ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles MyBase. Load End Sub Private Sub txt_1_KeyPress ( ByVal sender As Object , ByVal e As System. Windows. Forms. KeyPressEventArgs ) Handles txt_1. KeyPress If InStr ( 1 , "0123456789;.- " & Chr ( 8 ), e. KeyChar ) = 0 Then 'lm_no negativos e. KeyChar = "" End If End Sub Private Sub txt_1_TextChanged ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles txt_1. TextChanged End Sub Private Sub txt_2_KeyPress ( ByVal sender As Object , ByVal e As System. Windows. Forms. KeyPressEventArgs ) Handles txt_2. KeyPress If InStr ( 1 , "0123456789;.- " & Chr ( 8 ), e. KeyChar ) = 0 Then 'lm_no negativos e. KeyChar = "" End If End Sub
Private Sub txt_2_TextChanged ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles txt_2. TextChanged End Sub Private Sub btn_calcular_Click ( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btn_calcular. Click RE = Val ( txt_1. Text ) RI = Val ( txt_2. Text ) If RE > RI Then MsgBox ( "tienen que ser numeros positivos" ) 'lm_???? V = (( 2 / 3 ) * (( Math. PI ) * (( RE ^ 3 ) - ( RI ^ 3 )))) Label5. Text = V End If End Sub End Class