Selasa, 09 November 2010

PPROGRAM ZODIAC dengan DELPHI


Code Programnya:
unit zodiak;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    editnama: TEdit;
    Edittanggal: TEdit;
    Editbulan: TEdit;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
    zodiak : string;
    bulan, tanggal : integer;
begin

tanggal := strtoint (edittanggal.text);
bulan   :=  strtoint (editbulan.Text);
      if (tanggal <1) or (tanggal >31 ) then
         messageDlg('tanggal salaah ',mtinformation,[mbOK],0)
       else
      if (bulan<1) or (bulan > 12) then
       messageDlg('bulan salah ' ,mtinformation,[mbOK],0)
       else
           begin
                if (bulan = 3) and (tanggal >= 21) or
                   (bulan = 4) and (tanggal <= 19) then
                   zodiak := ' aries '
                else
                if (bulan =4) and (tanggal >= 20) or
                   (bulan =5) and (tanggal <= 20) then
                   zodiak := 'taurus'
                else
                if (bulan =5) and (tanggal >= 21) or
                   (bulan =6) and (tanggal <= 20) then
                   zodiak := 'gemini'
                else
                if (bulan = 6) and (tanggal >= 21) or
                   (bulan = 7) and (tanggal <= 22) then
                   zodiak := 'kenser'
                else
                if (bulan =7) and (tanggal >= 23) or
                   (bulan =8) and (tanggal <= 22) then
                   zodiak := ' virgo '

                 else
                if (bulan =8) and (tanggal >= 23) or
                   (bulan =9) and (tanggal <= 21) then
                   zodiak := ' libra'

                else
                if (bulan =9) and (tanggal >= 22) or
                   (bulan =10) and (tanggal <= 21) then
                   zodiak := ' Scorpion '
               else
                if (bulan =11) and (tanggal >= 22) or
                   (bulan =12) and (tanggal <= 21) then
                   zodiak := 'Sagitarius'
                  else
                if (bulan =12) and (tanggal >= 22) or
                   (bulan =1 ) and (tanggal <= 19) then
                   zodiak := ' Capricon '
               else
                if (bulan =1) and (tanggal >= 22) or
                   (bulan =2) and (tanggal <= 19) then
                   zodiak := 'Aquarius'
               else
               zodiak := 'Pices';
               messagedlg(' hai ,' + editnama.Text + ',zodiak anda -'
               + zodiak, mtinformation, [mbok], 0);

end;

end;

 procedure TForm1.Button2Click(Sender: TObject);

 begin
close;
end;

end.

Hasil dari promram ini  adalah:

2 komentar: