Rabu, 07 Maret 2012

Menentukan nilai IPK

Soal
Buatlah program yang menerima input nilai(dalam range 0 sampai 100) dan menghasilkan putput berupa keterangan nilai.
IPK Keterangan
0-15 Nilai E
16-40 Nilai D
41-60 Nilai C
61-80 Nilai B
81-100 Nilai A
Berikut ini tampilan formnya
Dan berikut syntaxnya
unit Utugas1;

interface

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

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

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var x:integer;
begin
x:=StrToInt(Edit1.Text);
if x>80 then Edit2.Text:='A'
else
if x>60 then Edit2.Text:='B'
else
if x>40 then Edit2.Text:='C'
else
if x>15 then Edit2.Text:='D'
else
Edit2.Text:='E'
end;

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

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

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

end.

0 comments:

Posting Komentar