Saturday, September 3, 2016

Leap Year Checker in Delphi

A program that I wrote using Delphi programming language that will ask the user to give a year and then our program will check if the given year by the user is a leap year or not a leap year. The code is very simple because I am using a function in Delphi called IsLeapYear() to check if the given year is a leap year or not. I hope you will find my work useful. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.





Sample Program Output


Program Listing

leap.pas

unit leap;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

Var Given_Year : Integer;

procedure TForm1.Button1Click(Sender: TObject);
begin

Given_Year := StrToInt(Edit1.Text);

If IsLeapYear(Given_Year) Then
    Label3.Caption := 'The year ' + Edit1.Text + ' is a Leap Year.'
Else
   Label3.Caption :=  'The year ' + Edit1.Text + ' is not a Leap Year.'
end;

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

end.



Linear Search in PHP

A simple program that I wrote that will perform sequential or linear searching from a list of names in an array in PHP. The code is very short and easy to understand.


Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.



Program Listing


<html>
<body>
<center>
<h1>Linear Search in PHP</h1>
<?php
$people = array("Peter", "Joe", "Pedro", "Maria","Ana","Luisa");
if (isset($_POST['find']))
{
    $val=$_POST['search_me'];
    if (in_array($val, $people))
      {
          echo "Match found from the list.";
      }
    else
      {
          echo "Match not found in the list.";
      }
}
?>
<form method="post" action="linear.php">
    Enter a Name to be search <input type="text" name="search_me">
    <input type="submit" value="Search" name="find">
</form>
</center>
</body>
</html>

Range of Fibonacci Numbers in PHP

A simple program that I wrote using PHP that will ask the user to give a range from lower bound to upper bound and then our program will generate a series of fibonacci number based on the range that is being specify by our user.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.



Sample Program Output


Program Listing

<html>
<head>
<title>
Range of Fibonacci Numbers
</title>
  </head>
<style>
body {
font-family:arial;
font-size  :20px;
background-color:lightgreen;
    }
    input[type=submit]
{
    font-size: 20px; 
    font-weight: bold;
    font-family: arial; 
    background-color: lightblue;
}
</style>
<body>
 <?php
 error_reporting(0);
 $a=$_POST['lower'];
 $b=$_POST['upper'];
 if(isset($_POST['clear']))
{
$a="";
$b="";
$fib3="";
}
 ?>
<BR>
   <h3>Range in Fibonacci Numbers</h3>
<form method="post" action="index.php" name="prime_me">
    Lower Bound &nbsp;&nbsp;<input type="text" name="lower" 
     size="5" value="<?php echo $a; ?>" autofocus>
    &nbsp;&nbsp;&nbsp;&nbsp;    
    Upper Upper Bound &nbsp;&nbsp;<input type="text" name="upper" 
     size="5"  value="<?php echo $b; ?>">
   <br><br>
    <input type="submit" name="check" value="Ok">
    &nbsp;&nbsp;&nbsp;&nbsp;  
    <input type="submit" name="clear" value="Clear">
</form>
<h3> DISPLAY RESULTS </h3>
<?php
if(isset($_POST['check']))
{
    $fib1=0;
    $fib2=1;
    $fib3=0;
    
    $a=$_POST['lower'];
    $b=$_POST['upper'];
        
for($i=$a;$i<$b;$i++)
      {
        if ($fib3<=$b)
            {
                if ($fib3>=$a)
                    {
                        echo " " .$fib3." ";
                    }
                $fib1=$fib2;
                $fib2=$fib3;
                $fib3=$fib1+$fib2;
            }
      }
}
?>
</body>
</html>




Range of Prime Numbers in PHP

Here is a simple program that I wrote in PHP as my programming language that will ask the user to give the range from lower bound and upper bound and generate the corresponding prime number from the given range. The code is very easy to undertand and use.


Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.




Sample Program Output


Program Listing

<html>
<head>
<title>
Range of Prime Numbers in PHP
</title>
  </head>
<style>
body {
font-family:arial;
font-size  :20px;
background-color:lightgreen;
    }
    input[type=submit]
{
    font-size: 20px; 
    font-weight: bold;
    font-family: arial; 
    background-color: lightblue;
}
</style>
<body>
 <?php
 error_reporting(0);
 $a=$_POST['lower'];
 $b=$_POST['upper'];
 if(isset($_POST['clear']))
{
$a="";
$b="";
}
 ?>
<BR>
   <h3>Range in Prime Numbers</h3>
<form method="post" action="prime.php" name="prime_me">
    Lower Bound &nbsp;&nbsp;<input type="text" name="lower" 
     size="5" value="<?php echo $a; ?>" autofocus>
    &nbsp;&nbsp;&nbsp;&nbsp;    
    Upper Upper Bound &nbsp;&nbsp;<input type="text" name="upper" 
     size="5"  value="<?php echo $b; ?>">
   <br><br>
    <input type="submit" name="check" value="Ok">
    &nbsp;&nbsp;&nbsp;&nbsp;  
    <input type="submit" name="clear" value="Clear">
</form>
<h3> DISPLAY RESULTS </h3>
<?php
if(isset($_POST['check']))
{
    $a=$_POST['lower'];
    $b=$_POST['upper'];
    $flag=0;
    for($a;$a<$b;$a++)
    {
        for($j=2;$j<$a;$j++)
        {
            if($a%$j==0)
            {
                $flag=1;
            }
        }
        if($flag==0)
            {
               echo " ".$a." ";
            }
        $flag=0;
    }
}
?>
</body>
</html>



Odd and Even Number Checker in Delphi

A very simple program that I wrote using Delphi as my programming language that will ask the user to give a number and then our program will check and determine whether the given number by our user is an odd or even number.

I am using Borland Delphi 7 as my Delphi compiler in this program. I hope you will like my work. Thank you very much.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.




Sample Program Output


Program Listing

even.pas

unit even;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

Var Number, Check : Integer;


procedure TForm1.Button1Click(Sender: TObject);
begin
Number := StrToInt(Edit1.Text);

Check  := (Number MOD 2);

If (Check = 0) Then
  Label5.Caption := 'The given number ' + Edit1.Text + ' is a an EVEN number.'
Else
  Label5.Caption := 'The given number ' + Edit1.Text + ' is a an ODD number.'
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text      :='';
Label5.Caption  :='';
Edit1.SetFocus;
end;

end.





Friday, September 2, 2016

Area of the Circle Solver in Delphi

A program that I wrote using Delphi that will ask the user to give the radius of the circle and then our program will compute for it's area. The code is very easy to understand and use. I intended my work for those that are beginners in Delphi programming.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

area.pas

unit area;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: 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}

const

Pi = 3.1416;

Var
  Radius : Integer;
  Area_Circle   : Real;

  procedure TForm1.Button1Click(Sender: TObject);
begin
Radius := strtoint(Edit1.text);
Area_Circle   :=  (Pi * Radius * Radius);
Label4.Caption := 'The area of the circle is ' + FormatFloat('0.00',Area_Circle);
end;

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

end.


Wednesday, August 31, 2016

Hello World in Delphi

A very simple program that shows a message box that display hello world using Delphi as our programming language.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

hello.pas

unit hello;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Hello World in Delphi');
end;

end.


  

Sum and Product in Delphi

A simple program that I wrote using Delphi as my programming language that will ask the user to give two numbers and then our program will compute the sum and product of the two numbers that is being given by our user.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.
  


Sample Program Output

Program Listing

sum_product.pas

unit sum_product;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

Var a,b : integer;


procedure TForm1.Button1Click(Sender: TObject);
begin
a:= strtoint(edit1.text);
b:= strtoint(edit2.text);
edit3.text := inttostr(a+b);
edit4.text := inttostr(a*b);
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
edit2.text := '';
edit3.text := '';
edit4.text := '';
edit1.setfocus;
end;

end.


Addition of Two Numbers in Dephi

This will be my first time to successfully understand and run a Delphi program that I wrote before I have some difficulty in understanding this programming language that is super set of Pascal programming language. It is very easy to write a code in Delphi once you have a good understanding of its environment, tools and of course the Pascal programming language.

In this sample program will ask the user to give two numbers and then our program will compute the sum of the two numbers given by the user. I have a great time learning Delphi it is very similar to Visual Basic the only difference is that it uses Pascal as its primarily programming language. Easy to learn and very fast to run the program.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.
  



Sample Program Output


Program Listing

add.pas

unit add;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    Edit3: TEdit;
    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 a,b : integer;


procedure TForm1.Button1Click(Sender: TObject);
begin
a:= strtoint(edit1.text);
b:= strtoint(edit2.text);
edit3.text := inttostr(a+b);
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
edit2.text := '';
edit3.text := '';
edit1.setfocus;
end;


end.