Kamis, 03 November 2011

coding delphi

sobat setia..
berikut coding delphi untuk aplikasi perhitungan nilai rata-rata siswa dan kriterianya..
sangat sederhana guys...moga bermanfaat...


unit Tugas;

interface

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

type
  TForm1 = class(TForm)
    label1: TLabel;
    label2: TLabel;
    label3: TLabel;
    label4: TLabel;
    label5: TLabel;
    label6: TLabel;
    label7: TLabel;
    label8: TLabel;
    label9: TLabel;
    ed_nim: TEdit;
    ed_nama: TEdit;
    ed_tugas: TEdit;
    ed_presensi: TEdit;
    ed_kuis: TEdit;
    ed_uts: TEdit;
    ed_uas: TEdit;
    ed_rata: TEdit;
    ed_keterangan: TEdit;
    Panel1: TPanel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  rata : real;
  nama, keterangan : string;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
    ed_nim.Enabled := true;
    ed_nama.Enabled := true;
    ed_tugas.Enabled := true;
    ed_presensi.Enabled := true;
    ed_kuis.Enabled := true;
    ed_uts.Enabled := true;
    ed_uas.Enabled := true;
    ed_nim.SetFocus ;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ed_nim.Enabled := false;
  ed_nama.Enabled := false;
  ed_tugas.Enabled := false;
  ed_presensi.Enabled := false;
  ed_kuis.Enabled := false;
  ed_uts.Enabled := false;
  ed_uas.Enabled := false;
  ed_rata.Enabled := false;
  ed_keterangan.Enabled := false;
end;

procedure TForm1.Button2Click(Sender: TObject);
var tugas, presensi, kuis, uts, uas : integer;

begin
   tugas := strtoint(ed_tugas.Text);
   presensi := strtoint(ed_presensi.Text);
   kuis := strtoint(ed_kuis.Text);
   uts := strtoint(ed_uts.Text);
   uas := strtoint(ed_uas.Text);

   rata := ( (2*tugas) + presensi + kuis + (3*uts) + (3*uas) ) / 10;

   ed_rata.text := floattostr(rata);

   if (rata >=9) then
      ed_keterangan.Text := ('A')
      else
   if (rata >=8) and (rata <9) then
      ed_keterangan.Text := ('B')
      else
   if (rata >=7) and (rata <8) then
      ed_keterangan.Text := ('C')
      else
   if (rata >=6) and (rata <7) then
      ed_keterangan.Text := ('D')
   else
      ed_keterangan.Text := ('E');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 application.Terminate;
end;

end.

LIFE IS NEVER FLAT...

Tidak ada komentar:

Posting Komentar

check it out

 
;