Thursday, February 26, 2015

Addition of Three Numbers in Java

In this short tutorial I would like to share with you a simple program that I wrote in Java how to add three numbers. What this program will do is very simple it will ask the user to enter three integer number and then our program will find the some of the three numbers given by our user. I also added a function that will ask the user if the user want to continue run the program again by asking the user do you want to continue. I am using Textpad as my text editor for Java and java scanner library class for input and output function in our program. I hope my simple program will help you understand basic programming concepts using Java.

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

import java.util.Scanner;

class addition
{

  public static  int add(int a,int b, int c)
   {
  return(a+b+c);
    }

public static void main(String args[])
{
  Scanner in = new Scanner(System.in);
   char a;
do
 {

 int num1=0,num2=0,num3=0,solve_addition=0;

 System.out.print("\n");
 System.out.println("==============================================");
 System.out.println("||    <<< ADDITION OF THREE NUMBERS  >>>    ||");
 System.out.println("==============================================");
     System.out.print("\n");
     System.out.print("Enter First  Number :=> ");
          num1 = in.nextInt();
          System.out.print("Enter Second Number :=> ");
          num2 = in.nextInt();
          System.out.print("Enter First Number  :=> ");
          num3 = in.nextInt();
          int result = add(num1,num2,num3);
     System.out.println("\n");
 System.out.println("=======================");
 System.out.println("||  DISPLAY RESULT   ||");
 System.out.println("=======================");
 System.out.println("\n");
 System.out.print("The sum of " +num1 + " , " + num2 + " and "
                   + num3 + " is " + result + ".");

          System.out.println("\n\n");
          System.out.print("Do you Want To Continue (Y/N) :=> ");
           a=in.next().charAt(0);

   } while(a=='Y'|| a=='y');
          System.out.println("\n");
          System.out.println("\t ===== END OF PROGRAM ======");
         System.out.println("\n");
}
}


Tuesday, February 24, 2015

Reverse a Number Program in Java


In this tutorial I would like to share with you a simple program that I wrote in Java that will ask the user to enter a number in integer format then it will reverse the arrangement of numbers. The code is very straight forward to follow and understand it will serve as a basis for anyone that are new in Java 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

import java.lang.*;
import java.util.Scanner;

class rev
{

public static void main(String args[])
{
  Scanner in = new Scanner(System.in);
   char a;
do
 {
    int num1=0,r=0;
    int solve_value=0;
 System.out.println("==============================================");
 System.out.println("||    <<< REVERSE A NUMBER PROGRAM >>>      ||");
 System.out.println("==============================================");
     System.out.print("\n");
     System.out.print("Enter a Number :=>");
          num1 = in.nextInt();
     System.out.println("\n");
 System.out.println("=======================");
 System.out.println("||  DISPLAY RESULT   ||");
 System.out.println("=======================");
 System.out.println("\n");
 System.out.println("Original Number Arrangement :=> " +num1 +".");
while(num1>0)
  {
r=num1%10;
solve_value=(solve_value*10)+r;
num1=num1/10;
          }
       System.out.println("Reverse of number result    :=> " +solve_value +".");
       System.out.println("\n");
       System.out.print(" Do you Want To Continue(Y/N) :=> ");
       a=in.next().charAt(0);

   } while(a=='Y'|| a=='y');
       System.out.println("\n");
       System.out.println("\t ===== END OF PROGRAM ======");
       System.out.println("\n");
}
}


Monday, February 23, 2015

Count Letters,Numbers and Spacing Program in Java

In this simple article I would like to share with you my avid reader a program that I wrote in Java as my programming language I called this program Count Letters, Numbers and Spacing Program. What this program will do is to ask the user to enter a sentence and then our program will count how many capital letters, lowercase letters, digits and spacing in our given sentence. I am using ASCII decimal values for letters, numbers and spacing in my program. I hope you will my work useful in your learning in Java 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

import java.util.Scanner;

public class count {

    public static void main(String[] args)
      {
        char ch;
        String str;

        int uppercase=0,lowercase=0, digits=0,space=0;

        Scanner in = new Scanner(System.in);

        System.out.println("==============================================");
        System.out.println("||Count Letters,Numbers and Spacing Program ||");
        System.out.println("==============================================");
        System.out.print("\n");
System.out.print("Enter a Sentence :=>");
        str = in.nextLine();
        for(int i=0;i<str.length();i++)
        {
            ch = str.charAt(i);
            int asciivalue = (int)ch;

          if(asciivalue >=65 && asciivalue <=90){
                uppercase++;
            }
            else if(asciivalue >=97 && asciivalue <=122){
                lowercase++;
            }
            else if(asciivalue >=48 && asciivalue <= 57){
    digits++;
            }
            else if(asciivalue >=32){
    space++;
            }
        }
       System.out.println("\n\n");
       System.out.println("=======================");
       System.out.println("||  DISPLAY RESULT   ||");
       System.out.println("=======================");
       System.out.println("\n");
       System.out.println("Number of UpperCase Letter(s) : " + uppercase + ".");
       System.out.println("Number of LowerCase Letter(s) : " + lowercase + ".");
       System.out.println("Number of Digit(s)            : " + digits + ".");
       System.out.println("Number of Spacing             : " + space + ".");
       System.out.println("\n");
       System.out.println("\t ===== END OF PROGRAM ======");
       System.out.println("\n");
    }
}

Capital, Small Letters and Digits Counter in C++

In this short tutorial I would like to share with you a sample program in C++ that will ask the user to enter a sentence and then our program will count the number of occurrence of capital, small and digits in a given sentence in C++. The code is very short and easy to understand it uses while loop and one dimensional array in our program.

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>
#include <stdio.h>
#include <stdlib.h>

using namespace std;


 int main() {

   int upper = 0, lower = 0, digits=0;

   char ch[120];   int i=0;

   cout << "===========================================\n";
   cout << " Capital, Small Letters and Digits Counter";
   cout << "\n";
   cout << "===========================================\n";
   cout << "\n\n";
   cout << "Enter A Sentence :=> ";
   gets(ch);

   while (ch[i] != '\0') {

      if (ch[i] >= 'A' && ch[i] <= 'Z')
         upper++;
      if (ch[i] >= 'a' && ch[i] <= 'z')
         lower++;
      if (ch[i] >= '0' && ch[i] <= '9')
         digits++;
      i++;
   }

   cout <<"\n==============================";
   cout << "\n";
   cout << "======= Display Result ======= ";
   cout << "\n==============================";
   cout << "\n";
   cout << "\n Number of  Uppercase Letters : " << upper;
   cout << "\n Number of Lowercase Letters  : " << lower;
   cout << "\n Number of Digits             :  " << digits;
   cout << "\n\n";
  system("pause");
}

DOWNLOAD SOURCE CODE HERE


Saturday, February 21, 2015

Count Capital and Small Letters in C

In this article I would like to share with you a code that I wrote using C language what this program will do is to ask the user to type a word or a sentence and then our program will count the number of occurrence of capital and small letters from the word or sentence being type or provided by our user of our program.
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 <stdio.h>

 
int main() {
   int upper = 0, lower = 0;
   char ch[80];
   int i=0;
   printf("\t Count Capital and Small Letters in C ");
   printf("\n\n");
   printf("\nEnter a sentence :=> ");
   gets(ch);

   while (ch[i] != '\0') {
        
      if (ch[i] >= 'A' && ch[i] <= 'Z')
         upper++;
      if (ch[i] >= 'a' && ch[i] <= 'z')
         lower++;
      i++;
   }

   printf("\n==============================");
   printf("\n");
   printf("======= Display Result ======= ");
   printf("\n==============================");
   printf("\n\n");
   printf("\n Number of  Uppercase Letters : %d", upper);
   printf("\n Number of Lowercase Letters : %d", lower);
   printf("\n\n");
  system("pause");
}



 

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>