'EJEMPLO DE MATRICULA BASADO EN FUNCIONES 
PUBLIC SUB Main()
DIM matr AS matricula
DIM nom AS String
DIM nmatri AS Integer
DIM parc1, parc2, parc3 AS Integer
matr = NEW matricula
'mat.matri(Now)
PRINT "La fecha de matricula es.....:", matr.matri()
PRINT "Ingrese nombre..."
INPUT nom
matr.PoneNombre(nom)
PRINT "Ingrese numero de matricula..:"
INPUT nmatri
matr.PoneApellido("MOREIRA")
'PRINT "la fecha de matricula es..", mat.Ponefecha("18/12/1992")
matr.PoneCurso("5 B Sistemas")
matr.PoneSeccion("Nocturno")
' FUNCIONES...."
PRINT "El nombre completo es....", matr.NombreCompleto()
PRINT "Curso : ", matr.Cursoactual()
PRINT "Seccion : ", matr.Seccionactual()
'INGRESOS
PRINT "Ingrese primer parcial...."
INPUT parc1
matr.Poneparcial1(parc1)
PRINT "Ingrese segundo parcial...."
INPUT parc2
matr.Poneparcial2(parc2)
PRINT "Ingrese tercer parcial...."
INPUT parc3
matr.Poneparcial3(parc3)
PRINT "El promedio es...", matr.promedio()
matr.equiv(parc1, parc2, parc3)
END
FUNCIONES DEL EJERCICIO PARA RECIBIR LOS VALORES INGRESADOS Y REALIZAR LAS OPERACIONES
PRIVATE Nombre AS String
PRIVATE Apellido AS String
PRIVATE Curso AS String
PRIVATE Seccion AS String
PRIVATE Fmatricula AS Integer
PRIVATE parcial1 AS Single
PRIVATE parcial2 AS Single
PRIVATE parcial3 AS Single
PUBLIC SUB PoneNombre(cadena AS String)
  Nombre = cadena
END
PUBLIC SUB PoneApellido(cadena AS String)
  Apellido = cadena
END
PUBLIC FUNCTION NombreCompleto() AS String
  RETURN Nombre & " " & Apellido
END
PUBLIC SUB Ponefecha(fecha AS Date)
  Fmatricula = Year(fecha)
END
PUBLIC FUNCTION matri() AS Integer
  RETURN Year(Now)
END
PUBLIC SUB PoneCurso(cadena AS String)
  Curso = cadena
END
PUBLIC FUNCTION Cursoactual() AS String
  RETURN Curso
END
PUBLIC SUB PoneSeccion(cadena AS String)
  Seccion = cadena
END
PUBLIC FUNCTION Seccionactual() AS String
RETURN Seccion  
END
PUBLIC SUB Poneparcial1(numero AS Integer)
  parcial1 = numero
END
PUBLIC SUB Poneparcial2(numero AS Integer)
  parcial2 = numero
END
PUBLIC SUB Poneparcial3(numero AS Integer)
  parcial3 = numero
END
PUBLIC FUNCTION promedio() AS Single
  RETURN (parcial1 + parcial2 + parcial3) / 3
END
PUBLIC FUNCTION equiv(parcial1 AS Integer, parcial2 AS Integer, parcial3 AS Integer) AS Integer  
DIM tp AS Integer 
PRINT "La Equivalencia es : "
  tp = (parcial1 + parcial2 + parcial3) / 3
  IF (tp > 0) AND (tp < 7) OR (tp = 0) THEN 
  PRINT "Insuficiente"
   ELSE 
   IF tp = 7 THEN 
   PRINT "Buena"
     ELSE  
     IF (tp = 8) OR (tp = 9) THEN 
     PRINT "Muy buena"
      ELSE 
      IF tp = 10 THEN
      PRINT "Sobresaliente"
      ENDIF 
     ENDIF 
   ENDIF 
  ENDIF    
END
miércoles, 4 de noviembre de 2009
Suscribirse a:
Enviar comentarios (Atom)
 
No hay comentarios:
Publicar un comentario