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.








Tuesday, August 30, 2016

Multiplication Table in Perl

A multiplication table that I wrote using PERL programming language the code is very short and easy to understand. I am using XAMPP in this sample 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

#!D:\xampp\perl\bin

use strict;

print "\n\n\n";
print "\t\t\tMULTIPLICATION TABLE   ";
print "\n\n";
for$-(1..12){
  printf'%5d',$_*$-for 1..12;
  print$/
}
print "\n\n";
print "\t\t\tEnd of Program";
print "\n\n";



Year Level Using Case Statement in Turbo Pascal

A simple program that I wrote that will ask the user to give its year level they belong using case statement in Turbo Pascal. The code is very simple 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.
  




Sample Program Output


Program Listing

Program High_School;
Uses WinCrt;

Var
Year : Integer;

Begin
 Clrscr;
 Writeln;
 Write('Give Year Level : ');
 readln(Year);

 Case Year Of

    1: Writeln(' You are belong to Freshmen');
    2: Writeln(' You are belong to Sophomore');
    3: Writeln(' You are belong to Junior');
    4: Writeln('  You are belong to Senior');
  Else
     Writeln(' Out of School ');
 End;
 Readln;

End.



Saturday, August 27, 2016

Payroll Program in COBOL

Here is a simple program payroll program that I wrote in COBOL that will ask the user to give the employees name, daily rate and number of days work and then our program will compute the employees salary.

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


******************************************************************
* Author: MR. JAKE R. POMPERADA
* Date: AUGUST 27, 2016        SATURDAY
* Purpose: PAYROLL PROGRAM
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. PAYROLL_PROGRAM.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 name_emp PIC X(20).
77 daily_rate PIC 9(4).
77 days_work PIC 9(4).
77 solve_salary PIC 9(4).
PROCEDURE DIVISION.
PARA.
DISPLAY "PAYROLL PROGRAM IN COBOL".
DISPLAY "".
DISPLAY "Name of the employee :".
ACCEPT name_emp.
DISPLAY "Give Daily Rate : ".
ACCEPT daily_rate.

DISPLAY "Number of Days Worked : ".
ACCEPT days_work.
COMPUTE solve_salary = (daily_rate * days_work).
DISPLAY "".
DISPLAY " Name : " name_emp.
DISPLAY "Gross Salary : Php " solve_salary.
STOP RUN.


 
 

Average of Three Numbers in COBOL

A simple program that I wrote using COBOL that will ask the user to give three numbers and then our program will find the average of the three numbers 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



******************************************************************

* Author: MR. JAKE R. POMPERADA
* Date: AUGUST 27, 2016 SATURDAY
* Purpose: AVERAGE OF THREE NUMBERS
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. AVERAGE_THREE_NUMBERS.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUM_1 PIC 9(4).
77 NUM_2 PIC 9(4).
77 NUM_3 PIC 9(4).
77 SOLVE_AVERAGE PIC 9(4).
PROCEDURE DIVISION.
PARA.
DISPLAY "AVERAGE OF THREE NUMBERS IN COBOL".
DISPLAY "".
DISPLAY "ENTER THE FIRST VALUE : ".
ACCEPT NUM_1.
DISPLAY "ENTER THE SECOND VALUE : ".
ACCEPT NUM_2.
DISPLAY "ENTER THE THIRD VALUE : ".
ACCEPT NUM_3.
COMPUTE SOLVE_AVERAGE = (NUM_1 + NUM_2 + NUM_3)/3.
DISPLAY "THE AVERAGE IS " SOLVE_AVERAGE.
STOP RUN.


Average of Three Numbers in Turbo Pascal

A simple program that will ask the user to give three numbers and then our program will compute the average of the three numbers being provided by the 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

Program average_three_numbers;
Uses WinCrt;

Var
  Choice : Char;
  num1,num2,num3 : Integer;
  Average : Real;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Average of Three Numbers in Turbo Pascal');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Enter three numbers : ');
     Readln(num1,num2,num3);
     Average := (num1+num2+num3)/3;
     Writeln;
     Write('The Average is ' ,Average:8:2,'.');
     Writeln;
     Writeln;
     Write('Continue [Y/N] : ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End.

Area of the Circle in Turbo Pascal

Here is a sample program that I wrote using Turbo Pascal for Windows to ask the user the radius of the circle and then our program will compute the area of the circle.

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
 
Program area_of_the_circle;
Uses WinCrt;
Const
  Pi = 3.1416;
Var
  Choice : Char;
  radius  : Integer;

Procedure convert_area(var radius : integer);
Var
  Area : real;
 
Begin
 Area := Pi * Radius * Radius;
 writeln('The Radius is ',Area:8:2);
End;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Area of the Circle Converter');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Enter the area of the circle : ');
     Readln(radius);
     Writeln;
     convert_area(radius);
     Write('Continue [Y/N] ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End.



Celsius To Fahrenheit in Turbo Pascal

A simple program that I wrote using Turbo Pascal that will ask the user to give the temperature in Celsius and then it will convert it in Fahrenheit equivalent.


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
 
Program celsius_to_fahrenheit;
Uses WinCrt;

Var
  Choice : Char;
  Celsius  : Integer;

Procedure convert_fahreneheit(var celsius : integer);
Var
  Fahrenheit : real;
 
Begin
 Fahrenheit:= (9/5) * celsius + 32;
 writeln('The Fahrenheit is ',Fahrenheit:8:4);
End;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Celsius To Fahrenheit Converter');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Enter temperature in Celsius : ');
     Readln(Celsius);
     Writeln;
     convert_fahreneheit(Celsius);
     Write('Continue [Y/N] ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End. 

Inches To Centimeter in Turbo Pascal

A simple program that I wrote using Turbo Pascal to ask the user to give a value in inches and then it will convert it to centimeter equivalent.  The code is very simple 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.




Sample Program Output


Program Listing

Program Inch_To_Cm;
Uses WinCrt;

Var
  Choice : Char;
  inch   : Integer;

Procedure inchtocm(var inch : integer);
Var
  Cm : real;
Begin
 cm := inch * 2.54;
 writeln(inch, ' inch is equal to ',cm:5:2,' cm');
End;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Inch To Centimeter Converter');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Give the value in inch : ');
     Readln(inch);
     Writeln;
     inchtocm(inch);
     Write('Continue [Y/N] ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End.



Saturday, August 20, 2016

Reverse a Number in Turbo Pascal

Here is a sample program that I wrote using Turbo Pascal For Windows that will ask the user to give a number and then our program will reverse the arrangement of the number.

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

Program Reverse_Number;
Uses WinCRT;

Var N,R : Longint;

Begin
  Clrscr;
  Write('Reverse a Number');
  writeln;
  Writeln;
  Write('Give a Number : ');
  Readln(N);
  Writeln;
  Write('===== The Result ======');
  Writeln;
  Writeln;
  Write('The Original Order : ',N);
  Writeln;
  Write('The Reverse Order  : ');
  While (N<>0) Do
    Begin
      R:= N MOD 10;
      Write(R);
      N := N Div 10;
    End;
    Readln;
  End.