Bonekaku


Senin, 15 Oktober 2012

Cara Merubah Celcius ke Farenheit dengan Delphi 7 dengan perulangan Refeat Until



1.Design Form




2.Design Properties
Objek
Caption
Name
Label1
Mencari Konversi suhu dari Celcius Ke Farenheit
Label1
Label2
Batas Awal
Label2
Label3
Batas Akhir
Label3
Label4
Penambahan
Label4
Label5
Hasil Dalam Celcius
Lcelcius
Label6
Hasil Dalam Farenheit
Lfarenheit
GroupBox1
Menentukan Batasan Awal(dalam celcius)
GroupBox1
GroupBox2
Daftar angka Dalam Konversi Suhu yang diPeroleh
GroupBox2
Button
OK
Bok
Button
CLOSE
Bclose
ListBox1
-
Lbcelcius
ListBox2
-
Lbfarenheit
Edit1
-
Eawal
Edit2
-
Eakhir
Edit3
-
Epenambahan
Form1
Perulangan Refeat Until
-


3. Ketentuan soal :

  1.  Batas Awal dan Batas Akhir diberikan untuk mengetahui nilai awal dan akhir derajat celcius yang ingin dihasilkan.
  2. Penambahan diberikan untuk memberikan penambahan dari awal untuk mencapai nilai akhir.
  3. Close adalah untuk keluar program.
  4. Rumus mencari Farenheit adalah = (1,8*Celcius) + 32.

4.Listing Program
unit Perulangan_Refeat_until;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    GroupBox1: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Eawal: TEdit;
    Eakhir: TEdit;
    Epenambahan: TEdit;
    Bok: TButton;
    GroupBox2: TGroupBox;
    Lcelsius: TLabel;
    Lfarenheit: TLabel;
    Lbcelsius: TListBox;
    Lbfarenheit: TListBox;
    Bclose: TButton;
    procedure BokClick(Sender: TObject);
    procedure BcloseClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BokClick(Sender: TObject);
var
d:integer;
g:integer;
h:Real;
k:Real;
begin
  k:=strtofloat(Epenambahan.Text);
  d:=0;
  g:=5;
  repeat
  d:=d+5;
  h:=(9/5*d)+32;
  Eawal.Text:=(floattostr(g));
  Eakhir.Text:=(floattostr(d));
  Lbcelsius.Items.add(inttostr(d));
  Lbfarenheit.Items.add(floattostr(h));
  Epenambahan.SetFocus;
  until d=20;
end;

procedure TForm1.BcloseClick(Sender: TObject);
begin
if application.MessageBox('Anda Yakin Akan Keluar Dari Program Ini?','Informasi',mb_yesno)=idyes then close;

end;

end.

Tidak ada komentar:

Posting Komentar