Saturday, March 21, 2015

Inverted Triangle Pattern in c++

In this article I would like to share with you a sample program that I wrote using C++ as my programming language that will display an inverted triangle pattern image. For this code I'm using two for loop statement to achieve the pattern design of the inverted triangle.



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



 Program Listing
#include <iostream>
#include <stdlib.h>

using namespace std;

   int a=0, b=0, c=0;
  
void display()
{

   cout << "\t INVERTED TRIANGLE";
   cout << "\n\n";
    for(a=20;a>=1;a-=1)
    {
        for(b=20;b>a;b-=1)
        {
                cout << " ";
        }
        for(c=1;c<(a*2);c+=1)
        {
                cout << "^";
        }
        cout << "\n";
    }
        cout << "\n\n";
}

int main()
{
    display(); 
    system("pause");
  }
 

Friday, March 20, 2015

Remove Vowel in Java


In this article I would like to share with you a sample program that will remove vowels in a given string or sentence of our user I called this program remove vowels written in Java as our programming language. What does our program will do is to ask the user to enter any string or sentence then our program will remove or delete vowels that can be found in a given string or sentence. Regardless if the string is lower case or upper case format. I hope you will find my work useful in your learning string manipulation in 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




Program Listing

import java.util.Scanner;

public class remove {
  static Scanner input = new Scanner(System.in);

  public static void main(String[] args) {

     char reply;
    do
      {
      System.out.print("\n");
 System.out.println("==============================================");
 System.out.println("||    <<<  REMOVE VOWEL PROGRAM     >>>     ||");
 System.out.println("==============================================");
      System.out.print("\n");
      System.out.print("Enter a Word or a Sentence :=>  ");
      String str = input.nextLine();
      String original_string = str;

    for (int a = 0; a < str.length(); a++) {
      char val = str.toUpperCase().charAt(a);
      if ((val == 'A') || (val == 'E')  || (val == 'I')
          || (val == 'O') || (val == 'U')) {
        String first = str.substring(0, a);
        String second = str.substring(a + 1);
        str = first + " " + second;

      }
    }
    System.out.println("\n");
    System.out.println("The Original String     :=> " + original_string + ".");
    System.out.println("The Remove Vowel String :=> "  +str+".");
    System.out.println("\n");
System.out.print("Do you Want To Continue (Y/N) :=> ");
     reply=input.next().toUpperCase().charAt(0);
    } while(reply=='Y');
    System.out.println("\n");
    System.out.println("\t ===== END OF PROGRAM ======");
    System.out.println("\n");
 }
}


Remove Vowels Program in PHP


In this article I would like to share with you a sample program that will remove vowels in a given string or sentence of our user I called this program remove vowels written in PHP as our programming language. What does our program will do is to ask the user to enter any string or sentence then our program will remove or delete vowels that can be found in a given string or sentence. Regardless if the string is lower case or upper case format. I hope you will find my work useful in your learning string manipulation 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




Program Listing

<html>
<title> Remove Vowels Program</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>


<?php

error_reporting(0);
$values = $_POST['value'];

$values2 = $values;
if(isset($_POST['check'])) {

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

      $vowels = Array('a','e','i','o','u','A','E','I','O','U');
      $vowels = Array('a','e','i','o','u','A','E','I','O','U');

   $results .=  "========================<br> ";  
   $results .=  "==== DISPLAY RESULT ====<br> ";
   $results .=  "========================<br>";  
   $results .=  "<br>";
   $results .= "The word or sentence is   :=>   " .$values."<br><br>";
   
for ($b=0;$b<strlen($values);$b++)
{
    for ($a = 0;$a<10;$a++)
        if ($values[$b] == $vowels[$a])
        {
            $values[$b]=" ";
            break;
        }
  }
   $results .= "Remove Vowel Sentence  :=>  " .$values."<br>";   
   
   }
  
    }
  
   
if(isset($_POST['clear'])) {
  $values2=" "; 
  $results= " ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">REMOVE VOWELS PROGRAM </h2>
  <br>
<form action="" method="post">
 Enter a Word Or Sentence : <input type="text" name="value"    value="<?php echo $values2; ?>" 
 autofocus  size=60/>
 <br><br>
   <input type="submit" name="check" value="Remove Vowels" 
  title="Click here to remove vowels in a given 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>


Remove Vowels Program in C++

In this article I would like to share with you a sample program that will remove vowels in a given string or sentence of our user I called this program remove vowels written in C++. What does our program will do is to ask the user to enter any string or sentence then our program will remove or delete vowels that can be found in a given string or sentence. Regardless if the string is lower case or upper case format. I hope you will find my work useful in your learning string manipulation in C++.

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 Program Output


Program Listing

#include <iostream>
#include <ctype.h>

using namespace std;


int main() {
    string text_me;
    char reply;
   do {
    cout << "\n\n";
    cout << "\t========================\n";
    cout << "\t REMOVE VOWELS PROGRAM\n ";
    cout << "\t========================\n";
    cout << "\n";
cout << "\tEnter a String :=> ";
getline(cin,text_me);
cout << "\n\n";
    cout <<"\tORIGINAL TEXT :=> " << text_me;

for (int i=0;toupper(text_me[i])!='\0';i++)
     {
if (toupper(text_me[i])==toupper('a')
            || toupper(text_me[i])==toupper('e')
            || toupper(text_me[i])==toupper('i')
            || toupper(text_me[i])==toupper('o')
            || toupper(text_me[i])==toupper('u'))
         {
text_me[i]=' ';
}
      }
cout << "\n\n";
cout <<"\tVOWEL REMOVE TEXT :=> " << text_me;
cout << "\n\n";
cout << "\t Do You Want To Continue Y/N :=> ";
cin >> reply;
} while(toupper(reply)=='Y');
cout << "\n\n";
cout << "\t === THANK YOU FOR USING THIS PROGRAM ===";
cout << "\n\n";
return 0;
}


Thursday, March 19, 2015

Student Address Book Using PDO in PHP

As a software engineer my main forte is web design and development particularly using PHP in the past I used procedural programming in PHP until now is some small not critical projects I'm still using this type of programming paradigm but when I try to learn how to program using PHP frameworks like Codeigniter, Zend, CakePHP it gives me a headache because I don't know object oriented programming in PHP. In order for me to overcome my weakness I study PDO of PHP Data Objects that gives me an edge and knowledge how to work on those PHP frameworks with some confidence. 

PHP Data Objects now a days is very hard to ignore primarily because all PHP Frameworks works with the concepts of object oriented programming paradigm and Design Patterns. Using prepared statement in PDO help us also to overcome SQL injection attacks in our websites. In this article I would like to share with you a simple program that I wrote using PHP Data Object to add, edit, delete and view student records in our address book. The code is very simple yet enable us to understand the inner working of PDO interaction with our MySQL database.  I hope you will find my work useful and beneficial in your learning in PHP programming and development.

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




Wednesday, March 18, 2015

Count the number of years and weeks in a given days in Java


In this article I would like to share with you a sample program that I wrote using JAVA I called this program Count Years or Weeks  in a given days Using JAVA. The code is very simple by the use of simple formulas I hope you will find my work useful in your programming assignments and projects in 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 year_count
{

  public static int solve_it(int days)
   {
 int years=0,solve=0,weeks=0;
 years = days/365;
 solve=days-(years*365);
 weeks=days/7;
      solve=days-(weeks*7);
      System.out.println(years + " Year(s) or " + weeks + " Week(s).");
      return 0;
    }

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

 int no_days=0;

 System.out.print("\n");
 System.out.println("=============================================================");
 System.out.println("||   <<< COUNT NO. OF YEARS OR WEEKS IN A GIVEN DAYS >>>   ||");
 System.out.println("=============================================================");
     System.out.print("\n");
     System.out.print("Enter Number of Days :=> ");
          no_days = in.nextInt();

     System.out.println("\n");
 System.out.println("=======================");
 System.out.println("||  DISPLAY RESULT   ||");
 System.out.println("=======================");
 System.out.println("\n");
          solve_it(no_days);


          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, March 17, 2015

Count Years or Weeks in a given days in C++

In this article I would like to share with you a sample program that I wrote using C++ I called this program Count Years or Weeks  in a given days Using C++. The code is very simple by the use of simple formulas I hope you will find my work useful in your programming assignments and projects in C++.

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



Program Lisitng

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{

 int years=0,days=0,weeks=0,solve=0;
 char reply;
 do {
 system("cls");
 cout << "\n==================================================";
 cout << "\n||  COUNT NO. OF YEARS OR WEEK IN A GIVEN DAY   ||";
 cout << "\n==================================================";
 cout << "\n\n";
 cout<<"ENTER NUMBER OF DAYS :=> ";
 cin>>days;
 years = days/365;
 solve=days-(years*365);
 weeks=days/7;
 solve=days-(weeks*7);

  cout << "\n\n";
  cout << "\n=========================";
  cout << "\n||  DISPLAY RESULTS    ||";
  cout << "\n=========================";
  cout << "\n\n";
  cout<<years << " Year(s) or " << weeks << " Week(s).";
  cout << "\n\n";
  cout << "Do you want to continue y/n :=> ";
  cin >> reply;
 } while (toupper(reply)=='Y');
  cout << "\n\n";
  cout << "======  THANK YOU FOR USING THIS PROGRAM =====";
  cout << "\n\n";
}


DOWNLOAD SOURCE CODE HERE



Monday, March 16, 2015

Occurrence of the Word Program in Java

In this short article I would like to share with you a sample program that I called Occurrence of the Word Program in Java. What does the program will do is to allow the user to enter a sentence that has a repetitive words and then our program will ask the user what word to be search and count its number of occurrence and then our program will count the number of times a certain word appears in a given sentence by our user.

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




Program Listing

import java.util.Scanner;

class count_words {


public static int find_words(String string, String substr) {
    int a=0;
    int second_string = 0;
    int count = 0;
    do {
        a = string.indexOf(substr,second_string);
        if (a != -1) count++;
        second_string = a+substr.length();
    } while(a != -1);
    return count;
}

public static void main (String[] args ){

           Scanner in = new Scanner(System.in);
           String str1,str2,str3,str4;

           System.out.println("==============================================");
           System.out.println("||      OCCURENCE OF THE WORD PROGRAM       ||");
           System.out.println("==============================================");
           System.out.print("\n");
        System.out.println("Enter a Sentence      :   ");
        System.out.print("\n");
           str1 = in.nextLine();
           str3 = str1.toUpperCase();
           System.out.print("\n");
           System.out.print("Enter a word to count : ");
           str2 = in.nextLine();
           str4 = str2.toUpperCase();
           System.out.println("\n");
           System.out.println("The number of occurrence in the word : " + str4 + " is "
                             + find_words(str3,str4 ) + ".");
           System.out.println("\n");
 }
}


Saturday, March 14, 2015

Simple Multiplication Table in C++

Here a simple multiplication table in C++ that I wrote a very long time ago using for loop statements and built in library in C++. I hope beginners in C++ programming find my work useful and beneficial in their school assignments and projects.

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 Program Output 

Program Listing

#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[])
{
    int values[10] = {1,2,3,4,5,6,7,8,9,10};
    int values2[10] = {10,9,8,7,6,5,4,3,2,1};

     cout << "\n\n";
     cout << " ===== SIMPLE MULTIPLICATION TABLE =====";
     cout << "\n\n Created By: Mr. Jake R.Pomperada,MAED-IT";
     cout << "\n\n";

    for (int list=0; list <10 ; list++) {
        cout << "\n";
        cout<< setw(2) << list[values] << " x " <<
             setw(2) << list[values] << " = " <<
             setw(2) << list[values] * list[values];


        cout<< setw(10) << list[values] << " + "  <<
             setw(2) << list[values2] << " = " <<
             setw(1) << (list[values] + list[values2]);

        }
        cout << "\n\n";
    system("PAUSE");
    return EXIT_SUCCESS;
}




 

Payroll System in C++ With Colors

In this article I will show you an application that I wrote in C++ I called it Payroll System in C++ with Colors. In this application I'm Using Dev C++ as my C++ compiler it is an open source program that is very good in writing C++ codes and what is important it is free.  Below is the list of colors that can be use using C++.

Color Codes:
 
0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White

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 Program Output

Program Listing

#include <iostream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

main(){
 string employee_name,position;
 float daily_rate=0.00,tax=0.00,sss=0.00,pag_ibig=0.00;
 float solve_salary=0.00, net_pay=0.00,total_deductions=0.00;
 int no_days_work=0;

 system("COLOR 69");
 cout << "\t ===== EMPLOYEE'S PAYROLL SYSTEM =====";
 cout << "\n\n";
 cout << "Enter Employees Name        :=>   ";
 getline(cin,employee_name);
 cout << "Enter Employees Position    :=>   ";
 getline(cin,position);;
 cout << "Enter Daily Salary Rate     :=> $ ";
 cin >> daily_rate;
 cout << "Enter Number of Day's Worked :=>   ";
 cin >> no_days_work;

  solve_salary = (daily_rate * no_days_work);

 cout << "\n\n";
 cout << "Your Gross Pay is $ " << fixed
      << setprecision(2) <<solve_salary << ".";
 cout << "\n\n";
 cout << "Enter Employee's Tax                    :=> $ ";
 cin >> tax;
 cout << "Enter Employee's SSS Contribution       :=> $ ";
 cin >> sss;
 cout << "Enter Employee's PAG-IBIG Contribution  :=> $ ";
 cin >> pag_ibig;

 total_deductions = (tax+sss+pag_ibig);
 net_pay = (solve_salary - total_deductions);

 cout << "\n\n";
 cout << "Total Deductions  $ " << fixed
      << setprecision(2) <<total_deductions << ".";
 system("COLOR A9");
cout << "\n\n";
cout << " ====== PAYROLL REPORT ======";
cout << "\n\n";
cout << " NAME : " << setw(5)<<     employee_name
      <<setw(8) << " POSITION : " << setw(5)<<  position
     << setw(8) << " NET PAY $ " << setw(5)<< net_pay;

cout << "\n\n";
system("pause");
}









Friday, March 13, 2015

Palindrome of Numbers in PHP

In this article I would like to share with you a sample program that I wrote in PHP that will accept a number and then it will check if the given number is a palindrome or not a palindrome. I called this program Palindrome of Numbers in PHP. For your information Palindrome means that when we read a word or number forward and backward it is the same for example of words that is palindrome in nature is RADAR, AMA, ANA and for numbers 141, 111, 212, 1441.  I hope you will find my work useful in your learning 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



Program Listing

<html>
<title> Palindrome of Numbers</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);
$number   = $_POST['numbers'];

if(isset($_POST['check'])) {
$title .= "<BR>";
$title .= " ============================= ";
$title .= " <br> ===== GENERATED RESULT ===== " ."<BR>";
$title .= " ============================= ";
$title .= "<BR><BR>";
$values=$number;

while((int)$number!=0)
{
$remainder=$number%10;
$sum=$sum*10+$remainder;
$number=$number/10;
}
if($sum==$values)
{
   $title .= "The " .$values." is a Palindrome Number.";
}
else
{
$title .= "The " .$values." is Not a Palindrome Number.";
}
     
}
if(isset($_POST['clear'])) {
  $number = " ";
  $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">Palindrome of Numbers</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter a Number : </label> &nbsp; <input type="text" name="numbers" 
           value="<?php echo $values; ?>" autofocus required size=10/><br> </div><br>
   <div class="button">
   <input type="submit" name="check" value="Check Palindrome"   id="submit"
  title="Click here to findout if a number is palindrome or not."/>
  <input type="submit" name="clear" value="Clear" id="submit"
  title="Click here to clear text box and values on the screen"/> </div>
</form>
<br> 
<?php 
echo $title;
 ?>
  </body>
</html>