ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

APUNTES DE FUNDAMENTOS DE PROGRAMACIÓN.

Maribel LeyvaApuntes6 de Abril de 2016

2.166 Palabras (9 Páginas)309 Visitas

Página 1 de 9

FUNDAMENTOS DE PROGRAMACION

Problema 1

Nombre del proyecto: Suma.vbp

Nombre del formulario: FrmSuma.frm

Leer dos números enteros e imprimir el resultado de la suma de dichos números.

Si x=5                y =20                el resultado es: 25

Si x=12                y=12                el resultado es: 24

Si x=10                y =2                es resultado es: 12

[pic 1]

Propiedades:

Objeto

Propiedad

Valor

Form1

Nombre

FrmSuma

Caption

Suma de dos números

Label1

Nombre

LblX

Alignment

1-Right Justify

Caption

X

Label2

Nombre

LblY

Alignment

1-Right Justify

Caption

Y

Label3

Nombre

LblL

Alignment

1-Right Justify

Caption

La suma es

Text1

Nombre

TxtX

Text

TabIndex

0

Text2

Nombre

TxtY

Text

TabIndex

1

Picture1

Nombre

PicResultado

Command1

Nombre

CmdSuma

Caption

Suma

TabIndex

2

Command2

Nombre

CmdSalir

Caption

Salir

TabIndex

3

Código:

Private Sub CmdSuma_Click ()

Rem declaración de variables

Dim x as integer

Dim y as integer

Rem lectura de los números

Rem la función val convierte texto a números

x=Val (TxtX.Text)

y=Val (TxtY.Text)

Rem borrar PicResultado

PicResultado.Cls

Rem establecer foco en TxtX

TxtX.SetFocus

Rem hacer el cálculo

PicResultado.Print  x + y

End sub

Private Sub CmdSalir_Click()

End

End sub

Problema 2

Nombre del proyecto: Trabajo.vbp

Nombre del formulario: FrmTrab.frm

Calcular el trabajo realizado por una fuerza en una distancia determinada.

Imprimir el resultado

Si f = 13

Si d = 8

T = f * d

El resultado es 104

[pic 2]

Propiedades:

Objeto

Propiedad

Valor

Form1

Nombre

FrmTrab

Caption

Calcular Trabajo

Label1

Nombre

LblF

Alignment

1-Right Justify

Caption

Fuerza

Label2

Nombre

LblD

Alignment

1-Right Justify

Caption

Distancia

Label3

Nombre

LblL

Alignment

1-Right Justify

Caption

Trabajo

Text1

Nombre

TxtF

Text

TabIndex

0

Text2

Nombre

TxtD

Text

TabIndex

1

Picture1

Nombre

PicResultado

Command1

Nombre

CmdCalcular

Caption

Calcular

TabIndex

2

Command2

Nombre

CmdSalir

Caption

Salir

TabIndex

3

Código:

Private Sub CmdCalcular_Click ()

Rem declaración de variables

Dim f As Integer

Dim d As Integer

Dim t As Integer

Rem establecer focos en TxtF

TxtF.SetFocus

Rem borrar PicResultado

PicResultado.Cls

Rem leer fuerza (f) y distancia (d)

f = Val (TxtF.Text)

d = Val (TxtD.Text)

t = f * d

Rem calcular el trabajo

PicResultado.Print t

End Sub

Private Sub CmdSalir_Click ()

End

End Sub

Problema 3

Nombre del proyecto: Calificación.vbp

Nombre del formulario: FrmCal.frm

Leer tres calificaciones entre 0 y 100, y calcular e imprimir el promedio como se indica a continuación.

Promedio de calificaciones.

Materia

Cal 1

Cal 2

Cal 3

Computación

67

89

78

Computación el resultado es:78

[pic 3]

Propiedades:

Objeto

Propiedad

Valor

Form1

Nombre

FrmCal

Caption

Promedios

Label1

Nombre

LblM

Alignment

1-Right Justify

Caption

Materia

Label2

Nombre

LblC1

Alignment

1-Right Justify

Caption

Calificación 1:

Label3

Nombre

LblC2

Alignment

1-Right Justify

Caption

Calificación 2:

Label4

Nombre

LblC3

Alignment

1-Right Justify

Caption

Calificación 3:

Label5

Nombre

LblL

Alignment

1-Right Justify

Caption

Promedio

Text1

Nombre

TxtM

Text

TabIndex

0

Text2

Nombre

TxtC1

Text

TabIndex

1

Text3

Nombre

TxtC2

Text

TabIndex

2

Text4

Nombre

TxtC3

Text

TabIndex

3

Picture1

Nombre

PicResultado

Command1

Nombre

CmdPromediar

Caption

Promediar

TabIndex

4

Command2

Nombre

CmdSalir

Caption

Salir

TabIndex

5

...

Descargar como (para miembros actualizados) txt (18 Kb) pdf (413 Kb) docx (1 Mb)
Leer 8 páginas más »
Disponible sólo en Clubensayos.com