program perhitungan IPK (memakai if...then)

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Panel1: TPanel;
    Button3: TButton;
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Edit1Click(Sender: TObject);
    procedure FormClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  IPK:real;
implementation

{$R *.dfm}

procedure TForm1.Button3Click(Sender: TObject);
begin
IPK:=StrToFloat(edit1.Text);
If (IPK <1) then Edit2.Text:='TIDAK LULUS'
else If (IPK <2) then Edit2.Text:='MENGULANG'
else If (IPK <3) then Edit2.Text:='BAIK'
else If (IPK <3.5) then Edit2.Text:='SANGAT BAIK'
else if (IPK <4) then Edit2.Text:='SEMPURNA'
else ShowMessage('MAAF, IP tertinggi itu 4');

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

procedure TForm1.Edit1Click(Sender: TObject);
begin
Edit1.Clear;
end;

procedure TForm1.FormClick(Sender: TObject);
begin
If (Edit2.Text='') then Edit1.Text:='Inputkan IPK';
end;

end.



klik disini untuk download programnya

Popular Posts