Saturday, February 21, 2015

Leap Year Lister in C++

In this article I would like to share with you my simple program written in C++ I called this program Leap Year Lister in C++. This program uses structure data structure in C++ and one dimensional array to accept ten items of year from the user. After the user type all ten item our program will check and determine if the given year is a leap year or not a leap year. The code is very simple and easy to understand for beginners in C++ programming.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Sample Output of Our Program


Program Listing

#include <iostream>

using namespace std;

struct leap_year {
   
    int year[10];
};



 main()
{
leap_year years;

cout << "LEAP YEAR LISTER IN C++";
cout << "\n\n";

for (int a=0; a<10; a++) {   
cout << "Enter year no. " << a+1 << " : ";
cin >> years.year[a];
}
for (int a=0; a<10; a++) { 
     
if(years.year[a] %4==0) {
cout << "\n\n";
cout << years.year[a] << " is a Leap Year.";
}
else {
cout << "\n";
cout << years.year[a] << " is Not a Leap Year";
  }
}
cout << "\n\n";
system("pause");
}



Friday, February 20, 2015

Least Common Multiple (LCM) Number Finder in PHP

In this article I would like to share with you a basic math problem in finding least common multiple numbers using PHP as my programming language. Least Common Multiple numbers it refers to the smallest nonzero number that is a multiple of two or more numbers.

I hope you will find my work useful in learning how to write a program in PHP as your programming language.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Sample Output of Our Program


Program Listing

<html>
<title>LCM Number Finder</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
 label{
    display: table-cell;
    text-align: justify;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
</style>
<?php
error_reporting(0);

$value1 = $_POST['val1'];
$value2 = $_POST['val2'];


$value1_one = (int)$value1;
$value2_two   = (int)$value2;

$temp1=$value1_one;
$temp2=$value2_two;
    while($temp1!=$temp2)
    {
        if($temp1>$temp2)
            $temp1-=$temp2;
        else
            $temp2-=$temp1;
    }

$solve =($value1_one*$value2_two)/$temp1;

if(isset($_POST['check'])) {
$title .= "<br>";
$title .= " ===== GENERATED RESULT ===== " ."<BR><BR>";
$title .= "The Least Common Multiple of Two Numbers "
       .$value1_one. " and ".$value2_two." is ".$solve.".<br><br>";
       
}
if(isset($_POST['clear'])) {
  $value1 = " ";
  $value2 = " ";
  $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">  LCM Number Finder</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter First Number  : </label> <input type="text" name="val1" 
           value="<?php echo $value1; ?>" autofocus required size=10/><br> </div>
<div class="row"> <label> Enter Second Number  : </label><input type="text" name="val2" 
           value="<?php echo $value2; ?>" required size=10/><br> </div>
  <br>
   <input type="submit" name="check" value="Find LCM Here" 
  title="Click here to find the least common multiple number."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>

Password System Using Sessions in PHP

In this article I would like to share you a sample code in PHP that will show you how to use sessions in PHP in more easier manner. Sessions is a very important subject to be learn in PHP programming it enables us to understand how the web works.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Sample Output of Our Program


Wednesday, February 18, 2015

Auto Complete in PHP, MySQL and JQuery

In this article I would like to share with you as sample code that demonstrate how to auto complete a word while you are searching using PHP, MySQL and JQuery. My work is based on the work of  TutsForWeb the website can be located in this following link http://tutsforweb.blogspot.com/2012/05/auto-complete-text-box-with-php-jquery.html i found their work useful in web design and development so that's why I used it in my example in this article.

What is program will do is to ask the user to type the name of a programming language in the text field is the letter or word match it will display on the screen it makes searching of records much easier compared with the traditional way. I'm using the Jquery library autocomplete to perfrom the task of autocomplete. I hope you will find my work useful in your building of web based application using PHP as your main progrmming language.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Sample Output of Our Program





Power of a Number in PHP

In this program will ask the user to enter the base and exponent of a number a number and then it will compute for the power of the number given by the user. Example if our user will give 5 as its base  and the exponent is 3 the computed result is 125. As simple as 5 * 5 *5 we just multiply 5 by 3 time. 

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Sample Output of Our Program

Program Listing

<html>
<title> Power of a Number </title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
 label{
    display: table-cell;
    text-align: justify;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
</style>
<?php
error_reporting(0);

$base = $_POST['base'];
$exponent = $_POST['exponent'];


$base2 = (integer)$base;
$exponent2   = (integer)$exponent;



  $value=1;
  while ($exponent2!=0)
  {
      $value*=$base2;  
      --$exponent2;
  }


if(isset($_POST['check'])) {

$title .= "<br> ===== GENERATED RESULT ===== " ."<BR><BR>";
$title .= "The compute result is ".$value.". <br><br>"; 

    
       
}
if(isset($_POST['clear'])) {
   $base = " ";
   $exponent = " ";
   $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Power of a Number</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter Base Number    : </label> <input type="text" name="base" 
           value="<?php echo $base; ?>" autofocus required size=10/><br> </div>
<div class="row"> <label> Enter Exponent Number : </label><input type="text" name="exponent" 
           value="<?php echo $exponent; ?>" required size=10/><br> </div><br>
   <input type="submit" name="check" value="Find Power of a Number" 
  title="Click here to find power of a number."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>



Tuesday, February 17, 2015

Simple Interest Solver in PHP

In this article I will show you how to compute simple amount interest rate solver using PHP. This program is very useful if you want to learn how much the interest should be paid in a loan in a certain amount of time. The code is very short and very easy to understand I hope you will find my work useful.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Sample Output of Our Program

Program Listing

<html>
<title> Simple Interest Solver</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
 label{
    display: table-cell;
    text-align: justify;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
</style>
<?php
error_reporting(0);

$amount = $_POST['amount'];
$rate = $_POST['rate'];
$time    = $_POST['time'];

$amount2 = (float)$amount;
$rate2   = (float)$rate;


$Solve_Interest = ($amount2 * $rate2 * $time) / 100;
  
$Total_Amount = ($amount2 + $Solve_Interest);

if(isset($_POST['check'])) {

$title .= " ===== GENERATED RESULT ===== " ."<BR><BR>";
$title .= "The computed interest is Php ".number_format($Solve_Interest,2,'.','').".<br><br>"; 
$title .= "The Total Amount to be paid is Php ".number_format($Total_Amount,2,'.','')."."; 
    
       
}
if(isset($_POST['clear'])) {
  $amount = " ";
  $rate = " ";
  $time = " ";
  $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Simple Interest Solver</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter Principal Amount : </label> <input type="text" name="amount" 
           value="<?php echo $amount; ?>" autofocus required size=10/><br> </div>
<div class="row"> <label> Enter Rate of Interest  : </label><input type="text" name="rate" 
           value="<?php echo $rate; ?>" required size=10/><br> </div>
<div class="row"> <label> Enter Period of Time    : </label> <input type="text" name="time" 
           value="<?php echo $time; ?>"  required size=10/> </div> </div>   
  <br>
   <input type="submit" name="check" value="Compute Interest" 
  title="Click here to compute the Interest Amount."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>


Reverse a Number in PHP

In this article I have a wrote another simple program that uses PHP as my programming language I called this program reverse a number. What this program will do is very simple it will ask the user to enter a series of number digits and then our program will reverse the arrangement of the number let say the user give 12345 our program will convert in 54321. I hope you will find my program useful in learning how to write a program in PHP.

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

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Sample Output of Our Program



Program Listing


<html>
<title> Reverse a Number</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>
<?php
error_reporting(0);

$values = $_POST['value'];

  

if(isset($_POST['check'])) {

     if (ctype_alpha($values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
  $values="";
 }
 
else if(preg_match('#[^a-zA-Z0-9]#', $values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
        $values="";
      
}

    else  if ($values=="") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a integer value.');";
  echo "</script>";
  $values="";
           }
else { 
  $rem =0; $rev =0; 
    $originalnum = $values; 
  
  while($values > 1) { 
      $rem = $values %10; 
      $rev = ($rev * 10)+ $rem; 
      $values = $values/10; 
 } 
 
$title .= " ===== GENERATED RESULT ===== " ."<BR><BR>";
$title .= "Original Number Arrangement  : ". $originalnum."<br><br>"; 
$title .= "Reverse Number  Arrangement  : ". $rev; 

      }
       
}
if(isset($_POST['clear'])) {
  $values=" "; 
  $title= " ";
  
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Reverse a Number</h2>
  <br>
<form action="" method="post">
 Enter a Number : <input type="text" name="value" 
           value="<?php echo $originalnum; ?>" autofocus  size=20/>
   <input type="submit" name="check" value="Reverse Number" 
  title="Click here to reverse the number."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>





Monday, February 16, 2015

Area of the Circle Calculator

In this article I would like to share with you how to compute the area of the circle and its circumference using PHP as our programming language. What the program will do is to ask the user to enter the radius of the circle and then compute the corresponding area and circumference of the circle in meters. I hope you will find my work useful in your learning in PHP programming.

If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Sample Output of Our Program


Program Listing

<html>
<title> Area of a Circle Calculator</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>
<?php
error_reporting(0);

$values = $_POST['value'];

    $radius = (float)$values; 
    $circle = $radius * 2 * pi();
    $area = pow($radius, 2) * pi();
 


if(isset($_POST['check'])) {

     if (ctype_alpha($values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
  $values="";
 }
 
else if(preg_match('#[^a-zA-Z0-9]#', $values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
        $values="";
      
}

    else  if ($values=="") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a integer value.');";
  echo "</script>";
  $values="";
           }
else { 
      $title .= "The radius of the circle is " .$values.".<br><br>";
 $title .= "The circumference of the circle is: " 
            .number_format($circle,2,'.','')." m <br>";
      $title .= "The area of the circle is: ".number_format($area,2,'.','')." m&sup2;<br>";
 
       }  
   }  

if(isset($_POST['clear'])) {
  $values=" "; 
  $title=" ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Area of a Circle Calculator</h2>
  <br>
<form action="" method="post">
 Enter a Radius of the Circle : <input type="text" name="value" 
           value="<?php echo $values; ?>" autofocus  size=20/>
   <input type="submit" name="check" value="Compute Area" 
  title="Click here to know the area of the circle."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>


Friday, February 13, 2015

Capital Letters Counter in PHP

In this article I would like to share with you a sample program that enables the user to count the number of capital letters in a given word or sentence by our user. I wrote a function called count_capital_letters to count the occurrence of capital letters in a given word or sentence. I hope you will find my work useful in your programming assignments or projects in PHP.

 If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Sample Output of Our Program

Program Listing

<html>
<title> Capital Letters Counter</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>
<?php
error_reporting(0);

$values = $_POST['value'];

// function to count the number of capital letters
// in a given word or sentence.

function count_capital_letters($string) {
   return strlen(preg_replace("/[^A-Z]/","", $string));
}
  
if(isset($_POST['check'])) {

  if ($values==" ") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a number.');";
  echo "</script>";
  $values=" ";
  $results=" ";
     }

 if ($values != " ") {

   $results .=  "==== REPORT ==== ";
   $results .=  "<br><br>";
   $results .= "The sentence or the word is "
            ."<font color='RED'>".$values."</font>"."."
."<br><br>";
   $results .= "The number of capital letters is "
                ."<font color='RED'>".count_capital_letters($values)."</font> ".
" in a given word or sentence.";
   }
 }
      

if(isset($_POST['clear'])) {
  $values=" "; 
  $results= " ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">Capital Letters Counter in PHP</h2>
  <br>
<form action="" method="post">
 Enter a Word or a Sentence : <input type="text" name="value"    value="<?php echo $values; ?>" autofocus  size=40/>
 <br><br>
   <input type="submit" name="check" value="Count Capital Letters" 
  title="Click here to count the number of capital letters in a given word or sentence."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>
<br>
<?php 
echo $results;
 ?>
  </body>
</html>