Sunday, June 1, 2014

Sorting Three Numbers in C++

When is the last time we try to arrange or sort as series of numbers using pen and paper? That’s ok if you are trying to sort or arrange numbers that are very few but what is your are dealing of many numbers it seems that job is not easy using manual operation just like using pen and paper it very prone to errors and it takes a lot of effort in our part to sort each number in proper order. One of the benefits of your computers in general it helps us making our lives easier and less effort. The computer is a complex machine and has the ability to perform fast computation compared to its human counterparts. Sorting in computer science mean it is the arrangement of numbers, letters or works in ascending or descending order. Let me explain the two types of sorting arrangement in details.
Ascending sort mean that we arrange the numbers, texts or words small the smallest value to the highest number values. In terms of letters we start with letter A to Z as simple as that in ascending order. On the other hand descending order is the opposite of ascending order in this case from the biggest number value to the smallest number value or Z to A in terms in alphabets. In our sample code here I am not using any sorting algorithms to sort these three numbers. All we need is the use of the if – else statement to compare which of the three numbers is the smallest, middle and the highest number.
I call this program Sorting Three Numbers this program is not difficult but we must able to understand its inner logic with its conditional statement we use here that is If-Else statement in C++. The first thing that our program will do is to ask the user to enter three numbers simultaneously. In this case we assign three variables A,B,C. After we ask the user to enter three integer number our program will process this values using a series of conditional statements in C++.
if(a<b){
if(a<c){
cout<<a<<", ";
if(c<b)
cout<<c<<", "<<b<<"\n";
else cout<<b<<", "<<c<<"\n";
}
In this code if variable a is less than B then proceed with the second if statement if (a < c) if the condition in true then the smallest number is A will be displayed in our screen. This if-else statement that we have right now is called compounded or nested if-else statement because we have the outer if statement and inner if-else statement inside of it. The third condition is we select variable C that is the smallest number from the list of three given earlier by our user. So the arrangement if variable C is smallest will be cout<<c<<", "<<b<<"\n"; this means c is the smallest value and followed by b. If the condition is not true then it proceed with next statement that is cout<<b<<", "<<c<<"\n"; that meaning of this command is the variable B is the smallest value and then followed by the second value that is variable C.
else{
cout<<c<<", ";
if(a<b) cout<<a<<", "<<b<<"\n";
else cout<<b<<", "<<a<<"\n";
}
}
In this section of our code I will explain that if both two conditions is false then this will be the last condition of our first if-else statement by this time the value of variable C will be displayed in the screen and then we have another condition that tells us if (a<b) then the display will be cout<<a<<", <<b<<"\n"; and will followed by our else statement cout<<b<<", "<<a<<"\n";. At this point we can clearly see that we just rearrange the placement of our variable the fits in our condition. We are just dealing only with three numbers.
The second if-else statement we are dealing the if (b <c) then the display will be cout <<b<<”.”; Another condition if (a <c) the it will display cout << a <<”,” <<c<<”\n”; but it the condition is false it will display the cout << c<<”,”<<a<<”\n”;
if(b<c){
cout<<b<<", ";

if(a<c) cout<<a<<", "<<c<<"\n";

else cout<<c<<", "<<a<<"\n";
}
This is the last part of our code by this time we are dealing with the variable C is the condition is false then it will display the value of variable C. Next will follow the condition of if (a<b) then it will display cout << a << “,” <<c<<”\n”; and then if it is false it will display the following statements to the user cout<<b<<", "<<a<<"\n";
else{
cout<<c<<", ";
if(a<b) cout<<a<<", "<<c<<"\n";

else cout<<b<<", "<<a<<"\n";
}
}
After the execution of our program it will display a message that thanking the user for using our program and then it will return to your operating system. I hope you have learned something new in this article sorting three numbers. In this article I’m using CodeBlocks as my text editor and Dev C++ that is being integrated within our Codeblocks text editor. If you have some comments, questions and suggestions feel free to email me.

Thank you very much.


Sample Output Of Our Program


Code::Blocks text editor that is being used in writing this program


Program Listing

#include <iostream>
using namespace std;

int main()
{
int a=0, b=0, c=0;
cout << "\t <====== SORTING THREE NUMBERS =====>";
cout << "\n\n";
cout<<"Please Enter Three Numbers :=> ";
cin>>a>>b>>c;
cout << "\n\n";
cout<<"Numbers sorted in Ascending Order : ";
if(a<b){


if(a<c){
cout<<a<<", ";
if(c<b)
cout<<c<<", "<<b<<"\n";
else cout<<b<<", "<<c<<"\n";
}
else{
cout<<c<<", ";
if(a<b) cout<<a<<", "<<b<<"\n";
else cout<<b<<", "<<a<<"\n";
}
}
else{
if(b<c){
cout<<b<<", ";
if(a<c) cout<<a<<", "<<c<<"\n";
else cout<<c<<", "<<a<<"\n";
}
else{
cout<<c<<", ";
if(a<b) cout<<a<<", "<<c<<"\n";
else cout<<b<<", "<<a<<"\n";
}
}
cout << "\n\n";
cout << "THANK YOU FOR USING THIS PROGRAM";
cout << "\n\n";
system("pause");

}

Addition of Three Numbers Using AngularJS


As I started learning different programming languages I have learned that there are many libraries or frameworks that can help us in our day to day work as computer programmers and developers one of the most recent framework that I work with is a JavaScript framework named AngularJS.

AngularJS is an open source framework that is being manage by Google and the community to help programmers and developers to help them create single web page that uses HTML,CSS and Javascript in the client side. In addition AngularJS was designed with the use of the concept of Model-View-Controller capability to make web development and testing much easier to do.

In this example that I will show you I will write a simple program that uses AngularJS to find the sum of three numbers. What the program will do is very simple it will accept three numbers from the user, perform addition operation and then display the sum values of three number that is being given by the user.

I hope you will find my work useful in your programming projects and assignments in the near future.




Sample Output Of Our Program

Program Listing

add.htm

<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<script src="angular.js"></script>
<style>
.wrapper {
  width: 90%;
  display: block;
  margin: 0 auto;
  padding: 2.5em;
}
</style>

</head>
<body bgcolor="lightgreen">
<br><br>
   <h2><center> Addition of Three Numbers Using AngularJS </center> </h2>
   
   <div class="wrapper" ng-app>
  1st No.<input type="number" placeholder="Enter a number" ng-model="num1" /><br>
  2nd No.<input type="number" placeholder="Enter a number" ng-model="num2" /><br>
  3rd No.<input type="number" placeholder="Enter a number" ng-model="num3" />
  <p>The sum total of {{num1}}, {{num2}} and {{num3}} is {{ num1 + num2 + num3}}.</p>
</div>
   
</body>
</html>




Area of a Circle in Python


Beginners, students and hobbyist who spend their time in learning how to write simple program may encounter solving the problem of area of a circle by finding its radius. In this article I will show you how to write you own program in solving the area of the circle by using Python as your programming language. In developing this program I was able to identify what is the program should suppose to do. 

First our program will ask our user to enter the radius of our circle. After the user provided the radius of our circle our program will perform a series of computation to find the area of the circle. In this example of mine I have created a function to return the computed value of the area of the circle. I called the function area_of_circle(r) with a parameter r it represent the radius of our circle. The formula we use to find and solve the area of the circle is  a = r**2 * math.pi. The command math.pi is a built in function i Python which contains the fixed value of a pi of a circle that has a value of  3.141592653589793. In order for us to use the math.pi statement we must include this library file command on the top of our program with this command import math this instruction tells our Python compiler to include the math library file in our program so that we can use properly the math.pi statement in our program.

def area_of_circle(r):
    a = r**2 * math.pi
    return a

A function to solve the area of the circle 

In addition my program ask the user whether the user will continue to us the program of not. It enables our user to run the program again and give a another different value of area of the circle. By doing so it makes our program interactive, user friendly and more easier to us.

I hope you find my work useful in learning how to write a program using Python.

Thank you very much.


Sample Output Of Our Program


Python Text Editor where are program is written


Program Listing

# area of a circle solver
# Written By: Mr. Jake R. Pomperada, MAED-IT
# Tools : Python
# Date  : June 1, 2014

import math

def area_of_circle(r):
    a = r**2 * math.pi
   return a

print("\n")
print("@==============================@")
print("    Area of a Cirlce Solver     ")
print("@==============================@")

complete = False
while complete == False:
 print("");
 radius = int(input("What is the radius of the circle :=> "))
 print("");
 print ("The area of the circle is ",format(round(area_of_circle(radius),4)),'.')
 print("")

 choice = input("Are You Finish?  Y/N: ").lower().strip()

 if choice == "y":
      complete = True
 else:
      print("")

print("\n")
print("Thank You For Using This Program.")
print("\n")       


Consonants and Vowels Counter in Python

As I continue my study how to program in Python programming language I have discovered that Python has many build in functions that makes programming easier and fun. I have decided to create a program that I called Consonants and Vowels Counter what the program will do is very simple it will as the user to enter a sentence or a string and then the program itself will count the number of consonants and vowels in a given sentence or string.

In order for us to understand what are vowels and consonants let us have some little review what is a consonants. Consonants are letters that does not belong to A,E,I,O,U they are as follows B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y and Z. One of the built in command in Python in the list command where we can list down all the letters in vowels and consonants so that later on in our program we can easily search those letters in a given string or sentence by the user. The next portion of our program it will ask the user to enter a sentence or a string using the following commands words = input("Kindly enter a sentence or a word :=> ").lower().strip() again in Python programming we are allow to use a variable in our program without declaring it and having its own data type. In this case I use the keyword words as my variable to accept sentence, words or string from our user.

The function lower() and strip() that I added in our program will convert the sentence or string into lowercase and strip any special characters in a given sentence by our user of our program. The next commands number_of_consonants = sum(words.count(c) for c in consonants) and  number_of_vowels = sum(words.count(c) for c in vowels) will count the number of vowels and consonants in a given sentence by the user of our program. I am using a function in Python called count that will count the number of occurrence of vowels and consonants that is being store in our list function. We have also here a for loop statement with variable c which connect to our consonants and vowel variables.

After the checking and counting of consonants and vowels in our program we will display the results in our screen using the following commands print("The String is" ,str(words).upper(),"."), print(""), print(" Number of  Vowels     : ",number_of_vowels),  print(" Number of  Consonants : ",number_of_consonants) the first command it will display the sentence provided by our user in this case I converted the given sentence into uppercase format after which it will display how many vowels and consonants in the given sentence by our user.

The best thing about this Consonants and Vowels Counter Program that I wrote is that I added a while loop statement to enable the user to re run again the program so that it can accept another sentence or string. It makes our program interactive and more user friendly.

I hope for find my work useful in your quest in learning how to program in Python programming language. In my own opinion as a programmer I can say writing a program in Python is much easier and shorter compared with other programming languages like C,C++,C# and Java because it has many built it function that makes the life of a programmer a breeze.

Thank you very much.


Sample Output Of Our Program


Our Python Text Editor

Program Listing

print("\n")       
print("@==============================@")
print(" Consonants and Vowels Counter")
print("@==============================@")

vowels = list("aeiou")
consonants = list("bcdfghjklmnpqrstvwxyz")

complete = False
while complete == False:
  print("")       
  words = input("Kindly enter a sentence or a word :=> ").lower().strip()
       
  number_of_consonants = sum(words.count(c) for c in consonants)
  number_of_vowels = sum(words.count(c) for c in vowels)
  
  print("")       
  print("The String is" ,str(words).upper(),".")
  print("")
  print(" Number of  Vowels     : ",number_of_vowels)
  print(" Number of  Consonants : ",number_of_consonants)
  print("")
  choice = input("Are You Finish?  Y/N: ").lower().strip()
  if choice == "y":
       complete = True
  else:
       print("")
print("\n")       
print("Thank You For Using This Program.")
print("\n")       



Saturday, May 31, 2014

Books Information System in Visual Basic 6

Everyone of us likes to read books no question about it according to the research study conducted by scientist, educators and psychologist 70 to 80 percent of our learning abilities we get from reading. I totally agree on it in order for us to become literate we must read a lot and understand we read is very important. Teachers called it reading comprehension there are many books that is available to us specially in the bookstore and libraries in schools.  One of my hobbies is buying and reading books I like to read computer books, electronics, science and history related facts it makes me happy acquire new learning I guess and able to share it also to other people that I meet and talk with.
At school one of the most important services that any educational institution can offer to its faculties, staff and most importantly the student is the library. The library is a place where students, teachers and other worker in school can visit read books, magazines, news papers and periodicals. There are a wide selection of books to choose from technical books, novels, encyclopedias and magazines. The persons who is in charge in library is called the librarian they are the one who make sure the books are arrange very well, monitor the borrowers and returnee’s of borrowed books and also orders the necessary books need by the students and teachers in the school.
In this article I will share with you a program that I wrote last year for a client in United Kingdom that will store the information of different books in the library. I called this program Books Information System written entirely in Microsoft Visual Basic 6 as my front end and for my database and tables I am using Microsoft Access.  Now what this program will do it allows the librarian to add records of books, save the records of the books, search the book, delete the record of the book that is no longer available in the library and update the records of the book for the library.  The program I also included a function that allows the user or library to navigate the records of the book as simple as selecting move first, move next, move previous and move to the last record.
In addition for security I write a login function that will ask the user to enter the user name and password prior they will allow to us the book information system by doing so it will avoid intruders and unauthorized personnel to use the system without prior permission from the librarian.  I write this code using DAO and ADO database access in Visual Basic 6.
Thank you very much.


Sample Output Of Our Program

DOWNLOAD FILE HERE



Word Count Program in Python


This simple program that I wrote in Python programming language will ask the user to enter a sentence and then the program will count the number of words in the given sentence. I called this program Word Count Program in Python.The first part of program it will ask the user to enter a sentence using this command sentence = input("Please enter a sentence : ") the variable sentence will act as a holder in a given sentence by user. In Python the keyword input will accept a word or sentence from the user.

The second part of the program is the counting of words in the given sentence by the user I am using a variable count_words. After which I use the for loop statement to split the words in the given sentence of the user and then the variable counter to find the length of the sentence stored in variable a. Lastly the statement 
count_words += counter to count the number of words in the given sentence.

Finally after we accept input sentence from the user, count the number of words in the given sentence and then display the result of the screen. Making programs in Python is much easier compared to other programming languages because it has many built in functions to manipulate data such as numbers and strings.

I hope you will find my work useful in your quest in learning for to program in Python programming language.
Learning how to program is a journey and needs constant practice, perseverance and creative thinking.

Thank you very much.


Sample Out of Our Program


Python Text Editor Environment

Program Listing

# words.py
# Written By: Mr. Jake R. Pomperada, MAED-IT
# Language : Python
# Date     : May 31, 2014

def main():

    print("==========================")
    print("   Word Count Program     ")
    print("==========================")
    print("\n")

    sentence = input("Please enter a sentence : ")

    count_words = 0

    for a in sentence.split():
        counter = len(a) / len(a)
        count_words += counter
        
    print("\n")    
    print("Total number of words in a given sentence" ,int(count_words),".")
    print("\n")    
    print("\t Thank You For Using This Program")
    print("\n")    

main()






Students Grading System in MS Access

Being a teacher is not an easy job primarily because you are always dealing with your students in your class. You are not only discussing your lessons in your class but also you are evaluating the class performance of your students. One of the common responsibilities of a teacher to give quizzes, assignments, projects, recitations and periodical exams to their students every term. Let say in a particular school there school term is divided into four Prelim, Midterm, Prefinal and Finals terms.

It is a very tedious and prone to errors if you perform the computation by hand. One of my client here in the Philippines as me if I can make a Student Grading System that will automatically computes all the term grades of students, passed or failed remarks, sorts the names of the students automatically in the generated reports. So it take the challenge and create this Student Grading System using Microsoft Access.

The system is very easy to use and user friendly it also check for invalid values because there is a built in function in Microsoft Access to detect and inform the user for invalid values it makes our program more accurate.

I'm hoping this simple grading system that I wrote in Microsoft Access will give you some ideas and knowledge how to created your own student grading system that suites in your needs in school.

Thank you very much.


Sample Output Of Our Program


Report Generated By Our Student Grading System




Digital Clock in Java


One of the fascinating invention by man that amaze me is the clock or watch this object help us knows what is the exact time. It helps us in many ways in our day to day lives for instances what time we go to work and school, what time we to go sleep, what time we talk our medicine so that we will healed for our sickness. As a programmer there are many things that I have learned not only to solve programming problems but also mimic the real things that I can find in my surroundings.

In this article I will show you how create your own Digital Clock using Java as my programming language. I am using Swing Framework to create this program. There are many Java libraries that I used to create the graphical user interface of our Digital Clock I am very glad that Java is enriched with many build in library to do the graphical interface much easier that cannot be found in some programming language just like in C or C++.

Here is the library that I used to create our graphical user interface, time and calendar functions in Java import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import java.util.Calendar and import java.util.* all this library file is a part of Java programming language we must able to study each one of them to know more the different library functions which enhance and add functionality in our program.

I hope you find my sample program Digital Clock in Java useful in your learning in Java programming language. One of the things that I learned in Java know first what kind of problem you want to solve and select the appropriate library and frameworks that suited in your needs why because Java is a very big and complex language you may be lost if you are not aware of it.


Sample Output Of Our Program


The TextPad text editor that I used in creating our program

Program Listing

// clock.java
// Program code and Design By: Mr. Jake Rodriguez Pomperada,MAED-IT
// Tool : Java, TextPad Text Editor
// Date : May 31, 2014
// A Simple Digital Clock in Java

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.Calendar;
import java.util.*;

public class clock {

    public static void main(String[] args) {
        JFrame clock = new TextClockWindow();
        clock.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        clock.setVisible(true);
    }
}


class TextClockWindow extends JFrame {

    private JTextField timeField;

    public TextClockWindow() {

        timeField = new JTextField(10);
        timeField.setFont(new Font("sansserif", Font.PLAIN, 48));

        Container content = this.getContentPane();
        content.setLayout(new FlowLayout());
        content.add(timeField);

        this.setTitle("DIGITAL CLOCK By: Jake R. Pomperada, MAED-IT");
        this.pack();


        javax.swing.Timer t = new javax.swing.Timer(1000,
              new ActionListener() {
                  public void actionPerformed(ActionEvent e) {

                  Calendar calendar = new GregorianCalendar();
String am_pm;


                     Calendar now = Calendar.getInstance();
                      int h = now.get(Calendar.HOUR_OF_DAY);
                      int m = now.get(Calendar.MINUTE);
                      int s = now.get(Calendar.SECOND);


if( calendar.get( Calendar.AM_PM ) == 0 ){
           am_pm = "AM";

        }
        else{
            am_pm = "PM";

        }   // Code to Determine whether the time is AM or PM

timeField.setText("" + h + ":" + m + ":" + s + " " + am_pm);
                  timeField.setHorizontalAlignment(JTextField.CENTER);
               // Center the text
            timeField.getCaret().setVisible(false);
               // Hide the Cursor in JTextField
         }
              });
        t.start();
    }
} // End of Code













Vowel Count Program in C++


Everyone of us when we started our studies our teacher in our elementary days teach us the basic alphabets from A to Z. This fundamental aspect of learning is very important to us to be familiarizing the letters in our alphabet.  Some of us did not realize the words, phrase, sentences and paragraphs we write or read is a combination of letters that are derive from our alphabets. Our teacher told us to memorize and understand the consonants and vowels in our alphabets. The most easiest one is the vowels it is only consist of a very few letter A,E,I,O and U the rest of the remaining letters in our alphabets is already considered as consonants.

The use of computers now a days is very beneficial to us we can write a program that will count the number of vowels, consonants and numbers in a given sentence of our user.  In this article I will discuss and show you how to write a computer program that I called Vowel Count Program using C++ as our programming language.  The program logic and flow is not complicated as it may seem by most readers and programmers who read this article. What the program will perform is very simple it will ask the user to enter a sentence. After the user enter the sentence the program will count the frequency of vowel characters like A, E, I, O and U I also included the ability of the program to count how many digit numbers occurs in the given sentence by the user of the program. After which it will generate a report the shows the user the frequency of occurrence of vowel characters. The good this about this program also it will summarize the number of vowels in a sentence in our report.

The first line of code is the declaration of variables that will be used later on in our program we have this following variables int a=0,e=0,i=0,o=0,u=0,sum=0, digits=0; as we can clearly see all the variable is being declared as integer as its data type. As a review an integer data type is composed of positive, zero and negative whole numbers usually all loops and iteration statements in any programming language uses integer as it main data type.

I will discuss the main code of our program that will able us to count the number of vowels and digits in our program.

while ((c=getchar())!= '\n')    /* EOF means End of File*/
 {
  if (c=='a'||c=='A')
   a=a+1;
  if (c=='e'||c=='E')
   e=e+1;
  if (c=='i'||c=='I')
   i=i+1;
  if (c=='o'||c=='O')
   o=o+1;
  if (c=='u'||c=='U')
   u=u+1;

   if (c=='1'|| c=='2' || c=='3' || c=='4' || c=='5' ||
       c=='0'|| c=='6' || c=='7' || c=='8' || c=='9')
   digits++;
 }

There is a function in C++ called getchar()  it means  get character  I am using here I while loop statement while ((c=getchar())!= '\n')     this code means very simple after the user type all the words in a given sentence and then the user will press the enter key which being indicated with the use of the escape character code in C++  \n means new line it will count the number of characters in a give sentence for it its vowels for example  if (c=='a'||c=='A')   a=a+1;  the meaning of this code is c as character encounter  small letter a or bigger letter A it will count it as 1 vowel the same procedure and code is being used with the succeeding characters.  As we observe the code is iterative we are just changing the characters that we compare in our program. For our digit  this code is being used if (c=='1'|| c=='2' || c=='3' || c=='4' || c=='5' ||   c=='0'|| c=='6' || c=='7' || c=='8' || c=='9')    digits++; in computer programming there is a characteristic of the a variable conversion called coercion principle it means a value can be converted to another data type as we can see here 1 by nature is numeric can be converted into a character by simple putting a simple single quotation in our program ‘1’.

In this particular program that I wrote using C++ I am using CodeBlocks text editor with built in Dev C++ compiler that is also an open source project that can be downloaded in the Internet in the follow web address http://www.codeblocks.org/. The good thing about the CodeBlocks text editor not only it is free to use but also is very easy to navigate and use it generates also a true executable file of your program in C++.

I hope you find my work useful in learning how to program in C++ the programming language of choice for most system programming primarily because it works well in the hardware side of the computer system.

Thank you very much.


Sample Output Of Our Program


CodeBlocks Text Editor with Dev C++ Compiler we used in creating our program


Program Listing

#include <iostream>

using namespace std;

main()
{
 int a=0,e=0,i=0,o=0,u=0,sum=0, digits=0;

 char c;

 cout <<"\n\t\t ======[ Vowel Count Program ]======";
 cout <<"\n\n";
 cout <<" Enter string :=>  ";
 while ((c=getchar())!= '\n')  /* EOF means End of File*/
 {
  if (c=='a'||c=='A')
   a=a+1;
  if (c=='e'||c=='E')
   e=e+1;
  if (c=='i'||c=='I')
   i=i+1;
  if (c=='o'||c=='O')
   o=o+1;
  if (c=='u'||c=='U')
   u=u+1;

   if (c=='1'|| c=='2' || c=='3' || c=='4' || c=='5' ||
       c=='0'|| c=='6' || c=='7' || c=='8' || c=='9')
   digits++;
 }
 sum=a+e+i+o+u;
 cout <<"\n\n";
 cout <<"\t  =====[ REPORT ]=====";
 cout <<"\n\n";
 cout <<"\n Frequency of vowel 'a' is "<< a <<".";
 cout <<"\n Frequency of vowel 'e' is " << e << ".";
 cout <<"\n Frequency of vowel 'i' is " << i <<".";
 cout <<"\n Frequency of vowel 'o' is " << o <<".";
 cout <<"\n Frequency of vowel 'u' is " << u << ".";
 cout <<"\n\n Frequency of digits is " << digits << ".";
 cout <<"\n\n";
 cout <<"\n Total no. of vowels in the text is "  <<sum << ".";
 cout <<"\n\n";
 cout << "\t\t Thank you for using this program.";
 cout <<"\n\n";
 system("PAUSE");

}

Sum of Three Numbers in Python


As a beginner in Python programming it is not easy to write complex or sophisticated programs without learning how to write simple programs. Learning new programming language just like Python is just like learning a foreign language we must able to understand the word and its meaning. The syntax and the commands are very important to know how to use it properly. The way how the program works will follow as soon as the programmer understand how to use the language and the integrated programming environment just like here in Python.

Well about this program that I wrote in Python I called this program Addition of Three Numbers. This program is very simple in terms of its operation it will ask the user to give three numbers that is in integer in value and then display the total sum of the three numbers on the screen. One of the interesting features of Python that I have learned in writing this program is that I am using a function called input() to accept values from the user, however this function does not convert the number given by the user automatically in integer format. I have to use another function  called int() which converts the number given by the user from string value into integer value.

Using assignment operator Value_1, Value_2 and Value_3 I was able to store the number values given by the user. In addition the Python programming language allows us to use variable directly in our program without declaring it. If we compared in C,C++,Java and C# this programming language requires us to declare all the variable first including its data types before we can use it in our program.

I hope you find my work useful in learning how to program in Python programming language. Little by little your experience in writing simple program just like this one will pave way in your learning how to create much complex programs in the near future in your programming projects.

Thank you very much.


Sample Output of Our Program



Screenshot of Our Python Text Editor




Friday, May 30, 2014

Restaurant Inventory System in MS Access


This programming project that is being requested by my client to develop for their restaurant business here in the Philippines will monitor the day to day business transaction of stocks in their restaurant. I called this application Restaurant Inventory System written in Microsoft Access. This inventory system is designed to perform basic operations such as addition of stocks, quantity of product, cost, price, total stock remaining, sold out item and the remaining balance of the item available in the restaurant before the manager will order additional stocks from its supplier.

What is good about this restaurant inventory system is that the computation is automatically perform by the program itself and it stores the values and results automatically in Microsoft Access database. I also included a function to generate reports so that it is much easier for the manager and the owner of the restaurant to make a good decision on their inventory of their stocks in the restaurant.

I hope you find my work useful in creating your own restaurant inventory system.

Thank you very much.



Main Menu of Our Restaurant Inventory System



Generated Report of Our Restaurant Inventory System





Student Class Standing System in MS Access

One of my client ask me to write an application to solve the class standing of his student in his class in college. He wants a program that automatically computes the attendance, daily quizzes, recitation, student projects, class participation, class reporting of topics to be presented in the class and finally term exams.

As conduct a through interview with my client I was able to come up with the solution in my mind. The solution is to implement the purpose student class standing system using Microsoft Access. The main reason why I choose Microsoft Access as my tool in developing this kind of school application is very simple. Using Microsoft Access is easy and fun I can create an application in a very short period in time and less code compared with other database application in the market. And besides most computers today has already installed Microsoft Access in their Office applications.

What the program will do is to accept the name of school,course of the student, section and the subject that the student enrolled. There is a grid which the teacher can encode the names of his or her students and then the grade of the students in attendance, quizzes, projects, recitation, projects and term exams the program itself will automatically compute the term grade of the student enrolled in the subject and the program will also determine whether the student pass or failed in the said subject because I put some remarks. One of the feature of this Student Class Standing System is that the teacher can generate grade reports that can submitted to the registrars office for the submission of the grades of the students in the class.

I also make sure that the name of the student is sorted automatically in the program itself in Microsoft Access. Overall I make this program in two days only and delivered to my client with the time frame period and with the budget.

I hope you find my program useful in creating you own Student Class Standing System using Microsoft Access.

Thank you very much.


Student Class Standing System Main Menu



Report Generated for Student Class Standing System





Palindrome of String in Python


One of the most common programming problem that is related to string manipulation is all about Palindrome. In a simple explanation palindrome is a word, string or numbers that when we read it forward and backwards the spelling and the pronunciation is still the same. Common examples of word that are palindrome are as follows ana, radar, ama, boob, civic and hannah. 

In computer programming the word string refers to a list or series of characters. Examples of string is "john", "car","secret",'passwords" and many others in most programming language string is always enclosed with double quotations.This program works very simple it will ask the user to enter a string and then the program will determine whether the string that is being provided by the user is a palindrome or not a palindrome. 

The programming language that I implemented our program is python. It one of the most popular programming language that has a vast application in system, application and web development. I just started learning how to write in python it seems this programming language is easy to use and most of the common task and routine in programming is already built in in the language itself. This is very beneficial on the part of the programmer primarily because the programmer can more focus in solving the problem rather than thinking what kind of code to be used to perform a specific task in a problem.

I my own observation python is somewhat seminar to other programming language that is the C programming language, C++ and Java. The best thing about Python is that majoring of the applications written for Linux operating system is written using Python as its programming language. That's why no wonder the Python and Perl interpreter and compiler is already built in most Linux distribution. 

I hope you will find my palindrome program in Python useful in learning how to write a program using Python as your programming language.

Thank you very much.



This is the screenshot if the given word or string is a palindrome.



This is the screenshot if the given word or string is not a palindrome.


This is the Python built is text editor

Program Listing

# A program to check whether the given string is a palindrome or not 
# Author : Mr. Jake R. Pomperada
# Language : Python
# Date : May 30, 2014

print('\n') 
print('===================')
print('Palindrome Checker')
print('===================')
print('\n')

my_string = input("Kindly enter a string :==> ")

my_string = my_string.casefold()

reverse_string = reversed(my_string)

if list(my_string) == list(reverse_string):
   print('\n')
   print('The string ',my_string,' is Palindrome.')
else:
   print('\n')
   print('The string ',my_string,' is not a Palindrome.')

print('\n')   
print('Thank You Very Much For Using This Program')
print('\n')      



Consonants and Vowels Checker in Visual Basic 6

Learning to read and write are very essentials to everyone that’s why education is very important for every individual in this world. Being literate is a must for us we can’t find a better job is we were not able to finish our studies. One of the basic skills that the school can give to the student is to know how to differentiate consonants and vowels in the elementary level of educational learning of the student.

This consonants and vowels are the building blocks in any words, sentences and paragraphs that we have read, write and most importantly understand. Our teacher during the preschool or kinder garden levels teaches the students that vowels are those letters that are A, E,I,O and U while the consonants are those letters that does not belong to vowels. Having this knowledge we can build our own understanding about words, sentences, phrases and paragraphs that we read from newspapers, books, magazine, e-books or news over the Internet.

Being literate in terms of our vocabulary makes us more confident person and able to express ourselves to other people that we meet. It also help us boost our self confidence specially in applying for a job and during the interview portion we can answer our interviewer with ease and confidence compared to other applicants that are not frequent or proficient with their set of vocabulary.

In this article I will discuss a program that I wrote using Microsoft Visual Basic 6 that will accept a sentence from the user and then it will count the number of consonants and vowels in a given sentence. I called this program Consonants and Vowels Program, the basic structure of our program we start with the design of our user interface that will interact to our user. We have here a label control that will ask the user to enter a sentence in our text box control let us named our text box control txt_string we are applying the programming naming convention called Hungarian Notation.  After the user type the sentence, our program has three command button the first one is called Count when the user click the count button it will call the program to count the number of consonants and vowels in our sentence. And then display the two label results in our form.

I also included another command button Clear which allows the user to clear the content of the text box and the label in our form. It makes our user in control by allowing the user to enter a new set of sentence that will evaluated again by our program.  The third and last command button is the Quit which gives the user an option whether the user will continue using the program or quit and return to our windows operating system.  I make our program shorter and more easier so that everyone with a basic knowledge and understanding about programming can easily learn by using the codes in their particular programming projects and assignments.


Sample Output of Our Program



Quit Program Screenshot



Program Listing

Const vowels = "aeiou"
Const consonants = "bcdfghjklmnpqrstvwxyz"

' This function will count the number of vowels in a given sentence
Private Function CountVowels(strText As String) As Integer
    Dim i As Integer
 Dim asciiToSearchFor As Integer
    For i = 1 To Len(LCase(strText))
        If InStr(1, vowels, Mid$(strText, i, 1), vbTextCompare) Then
            CountVowels = CountVowels + 1
         End If
    Next i
End Function

' This function will count the number of consonants in a given sentence
Private Function CountConsonants(strText As String) As Integer
    Dim i As Integer
 Dim asciiToSearchFor As Integer
    For i = 1 To Len(LCase(strText))
        If InStr(1, consonants, Mid$(strText, i, 1), vbTextCompare) Then
            CountConsonants = CountConsonants + 1
         End If
    Next i
End Function

Private Sub cmd_clear_Click()
txt_string.Text = " "
lbl_consonants.Caption = " "
lbl_vowels.Caption = " "
txt_string.SetFocus
End Sub

Private Sub cmd_count_Click()
no_vowels = CountVowels(txt_string.Text)
no_consonants = CountConsonants(txt_string.Text)
lbl_consonants.Caption = "The number of consonants in a sentence is  " & no_consonants & "."
lbl_vowels.Caption = "The number of vowels in a sentence is  " & no_vowels & "."
End Sub
'Quit Procedure
Private Sub cmd_quit_Click()
Dim Response As Integer
Response = MsgBox("Are You Sure You Want To Quit The Program", vbYesNo + vbQuestion, "Quit Program")
If Response = vbYes Then
End
Else
Me.Show
Me.txt_string.Text = ""
lbl_consonants.Caption = " "
lbl_vowels.Caption = " "
Me.txt_string.SetFocus
End If
End Sub

I hope you have learned something new in this article that I write about making a program that will count the number of consonants and vowels in a given sentence using Microsoft Visual Basic 6. 

Thank you very much