Sunday, December 13, 2015

Area of a Circle Solver in CodeIgniter

A simple program that I wrote that will ask the user to give the radius of the circle and then our program will compute the area of the circle based on the value of the radius provided by the user using CodeIgniter PHP framework.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

Sample Program Output

Program Listing

<?php
error_reporting(0);

class circle extends CI_Controller
{

function index()
{
echo "<html>";
echo "<head>";
echo " <title>Area of a Circle Solver in CodeIgniter </title>";
echo "</head>";
echo "<style>";
echo "body {";
echo "font-family:arial;";
echo "}";
echo "</style>";
echo "<body>";

if(isset($_POST['submit'])){
   $radius = $_POST['radius'];
  
  $pi = 3.14159;
  $area = $pi * $radius * $radius;
  $solve= number_format($area, 2, '.', '');
  $result = "The area of the circle is " .$solve.".";
    
}

if(isset($_POST['clear'])){
   $radius="";
   $result = "";
  }

echo "<form action='' method='post' name='myform' align='center'>";
echo "<h3>Area of a Circle Solver in CodeIgniter </h3>";
echo "<br>";
echo "Give the radius of the circle &nbsp;&nbsp; <input type='text' name='radius' autofocus='true' value=$radius > ";
echo "<br><br>";
echo "<input type='submit' name='submit' value='Compute' ";
echo "title='Click here to find the area of the circle.' />";
echo "&nbsp;&nbsp;&nbsp;";
echo "<input type='submit' name='clear' value='Clear'";
echo "title='Click here to clear the text boxes.' />";
echo "</form>";
echo "<br>";
echo $result;

 }
}
?>


Do While Statement in C Language

A sample program that I wrote in C programming language to show how to declare and use the do while looping statement. The code is very simple I intended for beginners in C programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

Program Listing

 #include <stdio.h>
#include <stdlib.h>

main()
{
int number=0;
system("cls");

number = 1;
do
{
 printf(" %d " ,number);
 number=number+1;
}while (number <=10);

printf("\n\n");
system("pause");
}

Functions and Parameters in C language

A simple program that I wrote using C programming language to demonstrate how to write a function with parameters good for beginners in C programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

 Program Listing

#include <stdio.h>
#include <stdlib.h>

// declaration of function prototype

void hello(char user[50]);
// function with parameters

main()
{
system("cls");
// Calling the function with
// parameters
hello("John Smith");

printf("\n\n");
system("pause");
}

void hello(char user[50])
{
 printf("\t     Hello %s" ,user, ".");
 printf("\n\n");
 printf("\tWelcome To World City College");
}

Sum of Two Numbers in CodeIgniter

A sample program that I wrote using CodeIgniter one of the most popular PHP framework. What does the program will do is to ask the user to give to numbers and then our program will give the sum of the two numbers.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 

Sample  Program Output


Program Listing
 
 <?php

// create a file named "sum.php" and then save the file in the
// following path in CodeIgniter example below
// "C: /xammp/htdocs/Demo/application/controllers"

// To run the application follow the commands below
// http://localhost/ci/index.php/sum

 error_reporting(0);

class sum_two_numbers extends CI_Controller
{

function index()
{
echo "<html>";
echo "<head>";
echo " <title>Sum of Two Numbers in CodeIgniter</title>";
echo "</head>";
echo "<style>";
echo "body {";
echo "font-family:arial;";
echo "}";
echo "</style>";
echo "<body>";

if(isset($_POST['submit'])){
   $num1 = $_POST['num1'];
   $num2 = $_POST['num2'];
   $result = $num1 + $num2;
  
}

if(isset($_POST['clear'])){
   $num1 = "";
   $num2 = "";
   $result = "";
  }

echo "<form action='' method='post' name='myform' align='center'>";
echo "<h3>Sum of Two Numbers in CodeIgniter </h3>";
echo "<br>";
echo "Enter number 1:&nbsp;&nbsp; <input type='text' name='num1' autofocus='true' value=$num1  > ";
echo "<br>";
echo "Enter number 2: &nbsp;&nbsp;<input type='text' name='num2' value=$num2>";
echo "<br><br>";
echo "<input type='submit' name='submit' value='Sum' ";
echo "title='Click here to find the sum of two numbers.' />";
echo "&nbsp;&nbsp;&nbsp;";
echo "<input type='submit' name='clear' value='Clear'";
echo "title='Click here to clear the text boxes.' />";
echo "</form>";
echo "<br>";
echo "<table border='1' align='left'>";
echo "<td align='center'>Value No. 1</td>";
echo "<td align='center'>Operator</td>";
echo "<td align='center'>Value No. 2</td><td align='center'>Total Sum";
echo "</td></tr>";
echo "<tr><td align='center'>";
echo $num1;
echo "</td><td align='center'>+";
echo "</td><td align='center'>";
echo $num2;
echo "</td><td align='center'>";
echo $result;
echo "</td></tr>";
echo "</table>";

 }
}
?>
 
 

Employee's Information System in Visual Basic 6

A simple program that I wrote in Visual Basic 6 and Microsoft Access to manage the employee's records in the company. The code is very simple and easy to understand ideal for beginners.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 
 
 
Sample Program Output
 
 
 
 

Sunday, December 6, 2015

Persons Information System in PHP and MySQL

This program that I wrote in PHP and MySQL I made for my web programming class in PHP and MySQL I called this program Persons Information System that will store and process the information of a particular person in our database. It demonstrate how to use basic CRUD operations in PHP and MySQL. I hope you will find my work useful.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com


My mobile number here in the Philippines is 09173084360.



Sample Program Output

Tuesday, December 1, 2015

Area of a Square in JavaScript

This sample program will solve for the area of a square using JavaScript as our programming language.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Program Listing
 
 <html>
     <head>
         <Title>Area of a Square in JavaScript</Title>
     </head>   
       
    <body>   
  <h1> Area of a Square in JavaScript </h1>
<br>     

    Base :
      <input type="text" id="Base"/>
         <BR>
     Height:          :
      <input type="text" id="Height"/>
         <BR>   
  
         &nbsp;&nbsp;
             <input
                   type="button"
                   id="btnArea"
                    onclick="Area();"
                    value = "Compute"/>
             <div id = "divresult"></div>
     </body>
            
      <script>
           function Area(){
               var Base = document.getElementById("Base");
              var Height = document.getElementById("Height");
               var basevalue = Base.value;
               var heightvalue = Height.value;
               var result = (basevalue*heightvalue)/2;
               var divresult=document.getElementById("divresult");
               divresult.innerHTML=result;
           }
     </script>
                         
    </html>

String and Math Functions in JavaScript

This sample program will show you basic string and math built in functions in JavaScript that is very handy to use in our programming assignments and projects. I hope you will find our sample program useful.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 

Program Listing

<html>
    <head>
        <title> String and Math Functions</title>
        <script language = "Javascript">


        function dblenum(i)
        {
            dblnumber = numb * numb;
            return(dblnumber);
        }


        var name = prompt ("Enter your name:","");
        var numb = parseInt (prompt ("Enter any number:"," "));
        var deit = prompt ("Enter the date:","");
        var dt = new Date(deit);
       
        var sqre = dblenum (numb);

        document.write ("<center>");
        document.write ("Lowercase:     ",name.toLowerCase(),"<br>");
        document.write ("Uppercase:     ",name.toUpperCase(),"<br>");
        document.write ("Length:        ",name.length,"<br>");
        document.write ("Double:        ",sqre,"<br>");
        document.write ("Square Root:   ",Math.sqrt(numb),"<br>");
        document.write ("Round Off:     ",Math.round(numb),"<br>");
        document.write ("Date: Day   -  ",(dt.getDay()+1),"<br>");
        document.write ("      Month -  ",(dt.getMonth()+1),"<br>");
        document.write ("      Date  -  ",dt.getDate(),"<br>");
        document.write ("      Year  -  ",dt.getYear(),"<br>");
       
        </script>
    </head>

<body bgcolor = "green" text = "white">

</body>
</html>
 



Post command in PHP

This sample program will show you how to use POST command in PHP to accept and pass the value from one web page to another web page.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 
 
Program Listing
 
post.php
 
 <html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>

welcome.php
 
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>

Upload and Download Files in PHP and MySQL

A simple program that I wrote years ago that enables the user to upload and download files from a file server using PHP and MySQL. The code is not very difficult to understand and use.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





 

Sample Program Output
 
 
 




Sunday, November 29, 2015

Payroll System in PHP

A simple payroll system that I wrote before in my programming class in PHP for my student programming laboratories activities. I hope you will find my work useful in learning PHP.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>
<head>
<title>Employees Payroll System</title>
</head>
<body bgcolor="yellow">
<style type="text/css">
fieldset {
position:relative;
margin-top:30px;
height:360px;
border-color: green;
padding-top:10px;
border-width : 2px;
}
legend {
    _position : absolute;
    _top : -10px;
    font-weight : bold;
    font-size : 120%;
    padding : 0px 10px 0px 10px;
    border-color: green;
    border-style : solid;
    border-width : 2px;
    background-color : #C3E0E8;
}
  div 
padding-buttom : 10px; 
width : 350px;
text-align: right;   
}
label 
{
padding-right: 10px;
}
 </style>
<?php
 error_reporting(0);
 
$emp_name = trim($_REQUEST['emp_name']);
$emp_position = trim($_REQUEST['emp_position']);
$emp_salary = trim($_REQUEST['emp_salary']);

$with_tax = trim($_REQUEST['with_tax']);
$sss = trim($_REQUEST['sss']);
$phil_health = trim($_REQUEST['phil_health']);
$pag_ibig = trim($_REQUEST['pag_ibig']);


// Clear the text field

if ($_REQUEST['submit2']){
   $emp_name = "";
   $emp_position ="";
   $emp_salary = "";
   $with_tax ="";
   $sss ="";
   $phil_health="";
   $pag_ibig="";
     
}
// Here To Perform Computation of the Payroll

if ($_REQUEST['submit']){
    
$add_deductions = ($with_tax + $sss + $phil_health + $pag_ibig);
$compute = ($emp_salary - $add_deductions);
$total_deductions = number_format($add_deductions,2,'.',',');
$net_pay = number_format($compute,2,'.',',');
}
?>
<hr color="red" >
<marquee bgcolor="#000080" style="color: #FFFFFF; 
font-family: comic sans ms" font size = 5 behavior="alternate" > 
Employees Payroll System
</marquee>
<hr color="red">
<font face="comic sans ms" size=2 color="blue">
<form method="post" action="">
<fieldset>
  <legend> Employees Payroll System </legend>
  <div>
<label>Employees Name</label>
<input type="text" name="emp_name" value="<?php echo $emp_name; ?>">
  <br>
  </div>
  <div>
<label>Employees Position</label>
<input type="text" name="emp_position" value="<?php echo $emp_position; ?>">
   <br>
   </div>
   <div>
<label>Employees Salary</label>
<input type="text" name="emp_salary" value="<?php echo $emp_salary; ?>">
  <br>  <br>
  </div>
     <label>TOTAL DEDUCTIONS</label> <br>
     <div>
<label>With Holding Tax</label>
<input type="text" name="with_tax" value="<?php echo $with_tax; ?>">
</div>
   
  <div>
<label>Social Security System </label>
<input type="text" name="sss" value="<?php echo $sss; ?>">
  
  </div>
   <div>
  <label>PAG-IBIG Funds</label>
<input type="text" name="pag_ibig" value="<?php echo $pag_ibig; ?>"><br />
  </div>
 <div>
  <label>PHILHEALTH Insurance</label>
<input type="text" name="phil_health" value="<?php echo $phil_health; ?>"><br />
</div>
<br>
    <input type="submit" name="submit" value="Compute Salary"
    title="Click here to compute the salary.">
<input type="submit" name="submit2" value="Clear"
title="Click here to clear the textbox." >
  <br> <br>
   <font face="comic sans ms" size=3 color="blue">
   <div>
   <label> Employees Total Deductions $ </label>
<?php echo $total_deductions; ?><br />
  </div>
  <div>
   <label> Employees Net Pay $ </label>
<?php echo $net_pay; ?><br />
  </div>
  </font>
  </fieldset>
</form>
</font>
</body>
</html>

High and Low Number Checker in PHP

This sample program that I wrote in PHP will check for the highest and lowest number from the five number given by the user using one dimensional array in PHP. Take note I did not use any built in function in PHP like Max and Min function to determine the highest and lowest number. I hope you will find my work useful in learning how to program in PHP.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

<?php
error_reporting(0);
    
    
    $a = $_POST["numbers"][0];
    $b = $_POST["numbers"][1];
    $c = $_POST["numbers"][2];
    $d = $_POST["numbers"][3];
    $e = $_POST["numbers"][4];

if  ($_POST['send']) 
  {

      $list=array($a,$b,$c,$d,$e);

    $highest_number=0;
    
    $lowest_number=0;

    $high=0;
    
    $low=0;
    
    // checking for highest number
    
 $highest_number = $list[0];
    
    foreach($list as $high)
    {
      if ($highest_number < $high)
      {
        $highest_number = $high;
      } 
    }
                 
// checking for lowest number

$lowest_number = $list[0];

  foreach($list as $low)
      {
        if ($lowest_number > $low)
        {
          $lowest_number = $low;
        } 
     }
 }   


 if ($_POST['clear'])
   {
   $a=""; $b=""; $c=""; $d=""; $e="";
   $highest_number="";
   $lowest_number="";  
  }

?>
<html>
 <style>
 body {
  font-family:arial;
  font-size:12;
  }
</style>   
<title> Highest and Lowest Number Checker</title>
<form action = "" method = "POST">
<body>
<h3> Highest and Lowest Number Checker </h3>
<table border = "0">
<tr>
   <td> 1st Value </td>
   <td> <input type = "text" name ="numbers[]" value = "<?php echo $a;?>" size="5" autofocus required>
   </tr>
   <tr>
   <td> 2nd Value </td>
   <td> <input type = "text" name ="numbers[]"  value = "<?php echo $b;?>" size="5"  required>
   </tr>
   <tr>
   <td> 3rd Value </td>
   <td> <input type = "text" name ="numbers[]"  value = "<?php echo $c;?>" size="5" required>
   </tr>
   <tr>
   <td> 4th Value </td>
   <td> <input type = "text" name ="numbers[]"  value = "<?php echo $d;?>" size="5" required >
   </tr>
   <tr>
   <td> 5th Value </td>
   <td> <input type = "text" name ="numbers[]"  value = "<?php echo $e;?>" size="5" required>
   </tr>
   <tr>
   <td> &nbsp;</td>
   </tr>
   <tr>
   <tr>
   <td> <b> Highest Number </b> </td>
   <td> <input type = "text"  value = "<?php echo $highest_number;?>" size="5" readonly>
   </tr>
   <tr>
   <td> &nbsp;</td>
   </tr>
   <tr>
   <td> <b>Lowest Number </b> </td>
   <td> <input type = "text"  value = "<?php echo $lowest_number;?>" size="5" readonly>
   </tr>
   <tr>
   <td> &nbsp;</td>
   </tr>
   <tr>
   <td colspan = 3>
        <input type = "submit" name="send" value = "OK" title="Click here to check highest and lowest number.">
        &nbsp;&nbsp;
        <input type = "submit" name="clear" value = "Clear" title="Click here to clear text boxes.">
   </td>
   </tr>
   </table>
   </form>
  </body>
 </html>