Showing posts with label area of the rectangle in delphi. Show all posts
Showing posts with label area of the rectangle in delphi. Show all posts

Wednesday, September 28, 2016

Area of Rectangle in Delphi

Here is a sample program that I wrote using Delphi as my programming language that will compute the area of the rectangle. The code is very short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following 
jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

rectangle.pas

unit rectangle;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

  Var length : integer;
  Var    breadth : integer;
  Var   compute_all : integer;

procedure TForm1.Button1Click(Sender: TObject);
begin
      length := StrToInt(Edit1.Text);
      breadth := StrToInt(Edit2.Text);

      compute_all := (length * breadth);

      label4.Caption :=  'The Area of the Rectangle is '
            + IntToStr(compute_all) + '.';

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text     := '';
Edit2.Text     := '';
Label4.Caption :='';
Edit1.Setfocus;
end;

end.