Programacion en Delphi 7
{
Nombre: Vida Quispe Jesus Roberto
codigo SIS : 202103496
Interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
EditMateria: TEdit;
EditNota1: TEdit;
EditNota2: TEdit;
ButtonCalcular: TButton;
EditResultado: TEdit;
MemoResultado: TMemo;
procedure ButtonCalcularClick(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure [Link](Sender: TObject);
var
NotaParcial1, NotaParcial2, Promedio: Real;
begin
// Limpiar resultados anteriores
[Link];
[Link] := True;
[Link] := True;
// Obtener las notas
NotaParcial1 := StrToFloat([Link]);
NotaParcial2 := StrToFloat([Link]);
// Calcular el promedio
Promedio := (NotaParcial1 + NotaParcial2) / 2;
// Mostrar el nombre de la materia
[Link] := [Link];
// Mostrar el resultado basado en el promedio
If Promedio >= 51 Then
[Link]('El promedio es ' + FloatToStr(Promedio) + ' y aprobó.')
ElseIf Promedio >= 25 Then
begin
[Link]('El promedio es ' + FloatToStr(Promedio) + ' y reprobó.');
[Link]('Debe ir al examen final.');
[Link]('Está habilitado para instancia.');
End
Else
begin
[Link]('El promedio es ' + FloatToStr(Promedio) + ' y reprobó.');
[Link]('Debe ir al examen final.');
[Link]('No está habilitado para instancia.');
End;
End;
End.