unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Grids, DBGrids, DB, ADODB, XPMan;
type
TForm1 = class(TForm)
Label1: TLabel;
XPManifest1: TXPManifest;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
GroupBox1: TGroupBox;
Button1: TButton;
Label9: TLabel;
Label10: TLabel;
GroupBox2: TGroupBox;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
GroupBox3: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label2: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
ComboBox1: TComboBox;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Caption:='INPUT DATA';
edit1.Enabled:=true;
edit2.Enabled:=true;
combobox1.Enabled:=true;
edit3.Enabled:=true;
edit4.Enabled:=true;
edit5.Enabled:=true;
edit6.Enabled:=true;
label11.Enabled:=true;
Label12.Enabled:=true;
Label13.Enabled:=true;
edit1.SetFocus;
combobox1.ItemIndex:= -1;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ADOtable1.Append;
ADOtable1.FieldByName('NIM').AsString:=edit1.Text;
ADOtable1.FieldByName('Nama').AsString:=edit2.Text;
ADOtable1.FieldByName('JURUSAN').AsString:=combobox1.Text;
ADOtable1.FieldByName('NILAI PRAKTIK').AsString:=edit3.Text;
ADOtable1.FieldByName('NILAI TUGAS').AsString:=edit4.Text;
ADOtable1.FieldByName('NILAI UTS').AsString:=edit5.Text;
ADOtable1.FieldByName('NILAI UAS').AsString:=edit6.Text;
ADOtable1.FieldByName('RATA-RATA').AsString:=Label11.caption;
ADOtable1.FieldByName('GRADE').AsString:=Label12.caption;
ADOtable1.FieldByName('KETERANGAN').AsString:=Label13.caption;
ADOtable1.Post;
ADOtable1.Close;
ADOtable1.Open;
ADOtable1.Filtered:=false;
combobox1.ItemIndex:=-1;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
edit1.clear;
edit2.clear;
combobox1.clear;
edit3.clear;
edit4.clear;
edit5.clear;
edit6.clear;
label11.Enabled:=true;
Label12.Enabled:=true;
Label13.Enabled:=true;
edit1.SetFocus;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
ADOTable1.Delete;
edit1.Text:='';
edit2.Text:='';
combobox1.clear;
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
label11.Caption:='';
Label12.Caption:='';
Label13.Caption:='';
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if messagedlg('YAKIN UNTUK KELUAR..?!',mtconfirmation,[mbYes,mbNo],0)=mrYes then
begin
application.Terminate;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
nim,nama,jurusan,g,l:String;
a,b,c,d,r:real;
begin
nim:=edit1.text;
nama:=edit2.text;
jurusan:=ComboBox1.text;
a:=strtoint(edit3.text);
b:=strtoint(edit4.text);
c:=strtoint(edit5.text);
d:=strtoint(edit6.text);
r:=(a+b+c+d)/4;
label11.Caption:=FloatToStr(r);
if r>85 then begin
label12.Caption:='A';label13.Caption:='Selamat';l:='LULUS';
end
Else if r>70 then begin
label12.Caption:='B';label13.Caption:='Selamat';l:='LULUS';
end
else if r>60 then begin
label12.Caption:='C';label13.Caption:='Selamat';l:='LULUS';
end
else if r>50 then begin
label12.Caption:='D';label13.Caption:='SORRY !!';l:='TIDAK LULUS';
end
else begin
label12.Caption:='E';label13.Caption:='SORRY !!';l:='TIDAK LULUS';
end;
end;
end.

