Está en la página 1de 5

Software Movimiento Parablico

Diseo del Software:

Programacin del Software Movimiento Parablico o Lenguaje de Programacin - Visual Basic.Net 2010 En el cdigo desarrollado se puede encontrar el smbolo () donde nos especifican comentarios para ubicarnos y explicarnos el uso del Cdigo fuente.
Public Class Form1 Dim Dim Dim Dim Dim Dim vGravedad As Double = 10 largo As Integer nFinal As Integer nInicial As Integer nArriba As Integer nAbajo As Integer

Private Sub esquinas() nFinal = Me.lblFinal.Location.X nInicial = Me.lblinicial.Location.X nArriba = Me.lblarriba.Location.Y nAbajo = Me.lblAbajo.Location.Y End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.pbObjeto.Top = 290 Me.pbObjeto.Left = 3 Me.lblEtiquetaTMedio.Visible = False Me.lblTiempoSubida.Visible = False lblttotaltrans.Visible = False lbletiempototaltrans.Visible = False Label4.Visible = False Label5.Visible = False Me.lblTiempo.Text = "00.0" End Sub Dim segundo As Integer = 0 Dim milisegundo As Integer = 0 Sub tiempo() Me.lblTiempo.Text = 0 Me.lblTiempo.Text = segundo.ToString.PadLeft(2, "0") & "." Me.lblTiempo.Text &= milisegundo.ToString.PadLeft(1).ToString Me.lblTiempo.Refresh() End Sub Private Sub btnLanzar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Timer1.Enabled = True Then Timer1.Enabled = False Else Timer1.Enabled = True Dim segundo As Integer = 0 Dim milisegundo As Integer = 0 End If

'CONVERTIMOS LOS RADIANES EN ANGULO Dim radianes = 0, vSenAngulo = 0, vCosAngulo As Double = 0 radianes = (Math.PI / 180) '**Hallamos el Seno del Angulo (y) vSenAngulo = Math.Sin(Me.txtAngulo.Text * (radianes)) '**Hallamos el Coseno del Angulo (x) vCosAngulo = Math.Cos(Me.txtAngulo.Text * (radianes)) 'Hallamos la Velocidad X(hallamos vx) Dim vVelocidadX As Double = 0 vVelocidadX = Me.txtVelocidad.Text * vCosAngulo lblVelocidadX.Text = vVelocidadX 'Hallamos la velocidad Y (hallamos vy) Dim vVelocidadY As Double = 0 vVelocidadY = (txtVelocidad.Text) * (vSenAngulo) lblVelocidadY.Text = vVelocidadY

'Hallamos la altura maxima Dim vAltMaxima As Double = 0 vAltMaxima = (txtVelocidad.Text ^ 2) * ((vSenAngulo) ^ 2) / (2 * (9.8)) Me.lblAlturaMaxima.Text = vAltMaxima 'Hallamos el Alcance Dim vAlcance As Double = 0 Dim tiempo As Double = 0 tiempo = Me.lblTiempo.Text vAlcance = vVelocidadX * tiempo Me.lblAlcance.Text = vAlcance End Sub Dim sube_por_segundo As Double = 0 Sub subida_por_segundo() sube_por_segundo = lblAlturaMaxima.Text / lblTiempoSubida.Text sube_por_segundo = sube_por_segundo / 10 End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.lblAlcance.Text = Me.lblVelocidadX.Text * Me.lblTiempo.Text milisegundo += 1 If milisegundo = 10 Then milisegundo = 0 segundo += 1 End If tiempo() Velocidad_Final() 'Subida del Objeto subida_por_segundo() Me.lblResaltarY.Top = 300 - Me.lblVelocidadY.Text Me.lblResaltarY.Height = 300 If lblTiempo.Text <= lblTiempoSubida.Text Then Me.pbObjeto.Top = pbObjeto.Top - sube_por_segundo Else If lblTiempoSubida.Text < lblTiempo.Text Then Me.pbObjeto.Top = pbObjeto.Top + sube_por_segundo End If End If Dim alcan As Double = 0 alcan = lblAlcance.Text / lblTiempoSubida.Text alcan = alcan / 10 Me.pbObjeto.Left = Me.pbObjeto.Left + alcan If lblTiempo.Text = lblTiempoSubida.Text Then Me.lblEtiquetaTMedio.Visible = True Me.lblTiempoSubida.Visible = True Label4.Visible = True End If

If lblTiempo.Text = (lblTiempoSubida.Text * 2) Then Timer1.Enabled = False lblttotaltrans.Visible = True lblttotaltrans.Text = lblTiempo.Text lbletiempototaltrans.Visible = True Label5.Visible = True MsgBox("Llego a su destino") End If If pbObjeto.Left > 340 Then Timer1.Enabled = False MessageBox.Show("Usted a Excedido el Alcance maximo permitido, Porfavor Ingresar Numeros Menores", "Informacin", MessageBoxButtons.OK) End If End Sub Dim Tiempo_Subida As Double Sub Velocidad_Final() Tiempo_Subida = Me.lblVelocidadY.Text / vGravedad Me.lblTiempoSubida.Text = (Tiempo_Subida.ToString("00.0")) End Sub Private Sub btnLanzar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLanzar.Click If (txtVelocidad.Text > 9 And txtAngulo.Text > 9) Then If Timer1.Enabled = True Then Timer1.Enabled = False Else Timer1.Enabled = True Dim segundo As Integer = 0 Dim milisegundo As Integer = 0 End If 'CONVERTIMOS LOS RADIANES EN ANGULO Dim radianes = 0, vSenAngulo = 0, vCosAngulo As Double = 0 radianes = (Math.PI / 180) '**Hallamos el Seno del Angulo (y) vSenAngulo = Math.Sin(Me.txtAngulo.Text * (radianes)) '**Hallamos el Coseno del Angulo (x) vCosAngulo = Math.Cos(Me.txtAngulo.Text * (radianes)) 'Hallamos la Velocidad X(hallamos vx) Dim vVelocidadX As Double = 0 vVelocidadX = Me.txtVelocidad.Text * vCosAngulo lblVelocidadX.Text = vVelocidadX 'Hallamos la velocidad Y (hallamos vy) Dim vVelocidadY As Double = 0 vVelocidadY = (txtVelocidad.Text) * (vSenAngulo) lblVelocidadY.Text = vVelocidadY 'Hallamos la altura maxima Dim vAltMaxima As Double = 0 vAltMaxima = (txtVelocidad.Text ^ 2) * ((vSenAngulo)^2) / (2 *(9.8)) Me.lblAlturaMaxima.Text = vAltMaxima 'Hallamos el Alcance Dim vAlcance As Double = 0 Dim tiempo As Double = 0

tiempo = Me.lblTiempo.Text vAlcance = vVelocidadX * tiempo Me.lblAlcance.Text = vAlcance 'Mostramos el Objeto en la Altura Maxima Else MessageBox.Show("Porfavor Ingrese valores apartir de 10", "Advertencia", MessageBoxButtons.OK) End If End Sub Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNuevo.Click Timer1.Enabled = False Timer1.Interval = 100 'Variables largo = 0 nFinal = 0 nInicial = 0 nArriba = 0 nAbajo = 0 segundo = 0 milisegundo = 0 'aaaaaaaaa Me.txtVelocidad.Text = "" Me.txtAngulo.Text = "" Me.lblAlturaMaxima.Text = 0 Me.lblAlcance.Text = 0 Me.lblVelocidadX.Text = 0 Me.lblVelocidadY.Text = 0 Me.lblTiempo.Text = 0 Me.lblTiempoSubida.Text = "00.0" Me.lblttotaltrans.Text = "00.0" Me.pbObjeto.Top = 290 Me.pbObjeto.Left = 3 End Sub End Class

Formulario de Ayuda Indicaciones para el uso del programa.

También podría gustarte