EJERCICIO 1 ` Gambas class file PUBLIC SUB _new() END PUBLIC

Anuncio
EJERCICIO 1
' Gambas class file
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
END
PUBLIC SUB Label1_MouseDown()
END
PUBLIC SUB Label3_MouseDown()
END
PUBLIC SUB Label5_MouseDown()
END
PUBLIC SUB Label8_MouseDown()
END
PUBLIC SUB Label7_MouseDown()
END
PUBLIC SUB Button2_Click()
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
ListBox7.Clear
END
PUBLIC SUB Button1_Click()
DIM notas AS Integer[11, 6]
DIM n, i, j AS Integer
DIM mna, mnas, suma, suma1 AS Float
mna = 0
mnas = 0
suma = 0
suma1 = 0
FOR i = 1 TO 10
FOR j = 1 TO 5
n = InputBox("Ingrese nota del alumno" & (i) & (j))
notas[i, j] = n
NEXT
NEXT
FOR i = 1 TO 10
FOR j = 1 TO 1
ListBox1.Add(notas[i, j])
mnas = mnas + notas[i, j]
NEXT
NEXT
FOR i = 1 TO 10
FOR j = 2 TO 2
ListBox2.Add(notas[i, j])
mnas = mnas + notas[i, j]
NEXT
NEXT
FOR i = 1 TO 10
FOR j = 3 TO 3
ListBox3.Add(notas[i, j])
mnas = mnas + notas[i, j]
NEXT
NEXT
FOR i = 1 TO 10
FOR j = 4 TO 4
ListBox4.Add(notas[i, j])
mnas = mnas + notas[i, j]
NEXT
NEXT
FOR i = 1 TO 10
FOR j = 5 TO 5
ListBox5.Add(notas[i, j])
mnas = mnas + notas[i, j]
NEXT
NEXT
suma1 = suma1 + mnas / 5
ListBox7.Add(suma1)
FOR i = 1 TO 1
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 2 TO 2
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 3 TO 3
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 4 TO 4
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 5 TO 5
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 6 TO 6
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 7 TO 7
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 8 TO 8
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 9 TO 9
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
FOR i = 10 TO 10
FOR j = 1 TO 5
mna = mna + notas[i, j]
NEXT
NEXT
suma = suma + mna / 10
ListBox6.Add(suma)
END
EJERCICIO 2
' Gambas class file
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
END
PUBLIC SUB Button1_Click()
DIM h AS Integer[7, 8]
DIM habi, thc, i, j, hc, sprom AS Integer
DIM promhpt, promht AS Float
sprom = 0
FOR i = 1 TO 6
FOR j = 1 TO 7
habi = InputBox("Ingrese numero de habitantes" & (i) & (j))
h[i, j] = habi
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 1 TO 1
ListBox1.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 2 TO 2
ListBox2.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 3 TO 3
ListBox3.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 4 TO 4
ListBox4.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 5 TO 5
ListBox5.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 6 TO 6
ListBox6.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
FOR i = 1 TO 6
FOR j = 7 TO 7
ListBox7.Add(h[i, j])
hc = hc + h[i, j]
NEXT
NEXT
thc = thc + hc
ListBox8.Add(thc)
promht = thc / 7
ListBox10.Add(promht)
FOR i = 1 TO 1
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
FOR i = 2 TO 2
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
FOR i = 3 TO 3
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
FOR i = 4 TO 4
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
FOR i = 5 TO 5
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
FOR i = 6 TO 6
FOR j = 1 TO 7
sprom = sprom + h[i, j]
NEXT
NEXT
promhpt = sprom / 6
ListBox9.Add(promhpt)
END
PUBLIC SUB Button2_Click()
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
ListBox7.Clear
ListBox8.Clear
ListBox9.Clear
ListBox10.Clear
END
EJERCICIO 3
' Gambas class file
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
END
PUBLIC SUB Button1_Click()
DIM partidos AS Integer[4, 8]
DIM p, i, j AS Integer
DIM tvcp, tve, mayor, menor, promvn, tvcp1, tvcpa, tvcpb, tvcpc, tvcpd, tvcpe, tvea, tveb AS Float
tvcpe = 0
tvcpd = 0
tvcpc = 0
tvcpb = 0
tvcpa = 0
tvcp = 0
tve = 0
tvcp1 = 0
tvea = 0
tveb = 0
FOR i = 1 TO 3
FOR j = 1 TO 7
p = InputBox("Ingrese numero de votos obtenidos por cada partido" & (i) & (j))
partidos[i, j] = p
NEXT
NEXT
FOR i = 1 TO 3
FOR j = 1 TO 1
ListBox1.Add(partidos[i, j])
tvcp = tvcp + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcp)
FOR i = 1 TO 3
FOR j = 2 TO 2
ListBox2.Add(partidos[i, j])
tvcpa = tvcpa + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcpa)
FOR i = 1 TO 3
FOR j = 3 TO 3
ListBox3.Add(partidos[i, j])
tvcpb = tvcpb + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcpb)
FOR i = 1 TO 3
FOR j = 4 TO 4
ListBox4.Add(partidos[i, j])
tvcpc = tvcpc + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcpc)
FOR i = 1 TO 3
FOR j = 5 TO 5
ListBox5.Add(partidos[i, j])
tvcpd = tvcpd + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcpd)
FOR i = 1 TO 3
FOR j = 6 TO 6
ListBox6.Add(partidos[i, j])
tvcpe = tvcpe + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcpe)
FOR i = 1 TO 3
FOR j = 7 TO 7
ListBox7.Add(partidos[i, j])
tvcp1 = tvcp1 + partidos[i, j]
NEXT
NEXT
ListBox8.Add(tvcp1)
promvn = tvcp1 / 3
ListBox12.Add(promvn)
FOR i = 1 TO 1
FOR j = 1 TO 7
tve = tve + partidos[i, j]
NEXT
NEXT
ListBox9.Add(tve)
FOR i = 2 TO 2
FOR j = 1 TO 7
tvea = tvea + partidos[i, j]
NEXT
NEXT
ListBox9.Add(tvea)
FOR i = 3 TO 3
FOR j = 1 TO 7
tveb = tveb + partidos[i, j]
NEXT
NEXT
ListBox9.Add(tveb)
mayor = partidos[1, 1]
FOR i = 1 TO 3
FOR j = 1 TO 7
IF partidos[i, j] > mayor THEN
mayor = partidos[i, j]
ENDIF
NEXT
NEXT
ListBox10.Add(mayor)
menor = partidos[1, 1]
FOR i = 1 TO 3
FOR j = 1 TO 7
IF partidos[i, j] < menor THEN
menor = partidos[i, j]
ENDIF
NEXT
NEXT
ListBox11.Add(menor)
END
PUBLIC SUB Label14_MouseDown()
END
PUBLIC SUB Label15_MouseDown()
END
PUBLIC SUB ListBox11_Click()
END
PUBLIC SUB ListBox8_Click()
END
PUBLIC SUB Button2_Click()
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
ListBox7.Clear
ListBox8.Clear
ListBox9.Clear
ListBox10.Clear
ListBox11.Clear
ListBox12.Clear
END
PUBLIC SUB Button3_Click()
DIM r AS Integer
r = Message.Warning("¿Desea Salir?", "Si", "No")
IF r = 1 THEN
r = Message.Info("Gracias")
QUIT
ENDIF
END
Descargar