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




Saint Vincent High School Computer Online Tutorial System


As I gain experience in computer programming, web design and development there customer and clients who hire me to do their programming projects. One of this programming projects that I have done for the web is entitled Saint Vincent High School Computer Online Tutorial System. In the beginning I have some doubts whether I was able to do this project on time and within the budget primary because I don't have yet some experience in developing applications for the web. But my client is very confident enough to give me a chance and opportunity to work to his project so I give it a try.

What is system will do is quiet simple for some people first the system will display a main page which contains several links for basic computer tutorials. The content of each links starts which the brief history of computers, the scientists and persons involve in the invention and the development of computer technology, the different components of computers such as its hardware, software and people ware and finally the technology about the Internet, search engines, information gathering in the web and computer ethics and security as the last topics in the tutorials.

In every end of the chapter their is a quiz designed for the student to check their knowledge and understanding of the topic that is being discussed within each chapter. The best thing about this system that I wrote is the it count the number of correct and incorrect answers of the students and it generates reports and the grade of the student in the said chapter. The system will show also what is the correct answer to the question where the student made a mistake. It also compute the grades of the student for the particular chapter of the topic which can be used by the teacher as an assessment method for giving grades to the student in their computer subject in the school.

When we taking about the security the system will allow only students that was able to register in the website. The student will able to register their username, password, student name, section and subject in the system to insecure that only qualified student can only use the system. 

I wrote this Saint Vincent High School Computer Online Tutorial System using HTML, CSS, Javascript and PHP and MySQL. For my text editor I'm only using Notepad++ that is an open source text editor that can be downloaded free from the Internet and WAMP Server for the PHP compiler and my web server is Apache.

I hope this program of my mine can give you an idea how to great your own online computer tutorial system using PHP and MySQL.

Thank you very much.


Sample Output of Our Program


Digital Clock in Visual Basic 6


Computers plays an important role in our day to day lives it can be used to process information that is useful in making good decisions whether in business or in our personal decisions. In this article I will show you how to make a simple Digital Clock using Microsoft Visual Basic 6.

This program will display the current time in your computer in digital format. Making this program is very easy because in Visual Basic 6 there are many controls that makes computer programming more easier to implement. I'm using a timer control in this program and label control to display the current time from our computer. 

If you wonder how the computer know the exact time very simple our computer is equip of a CMOS chip. CMOS means complimentary metal oxide semiconductor that stores the computer related instructions including the date and time of our computer. Even the computer is off but still the time and date is updated because it have a battery that connected in the computer motherboard.

I hope you find my program useful in learning how to  a programming using Microsoft Visual Basic 6.

Thank you very much until the next article.



Sample Output of Our Program


Program Listing

Private Sub Form_Load()
Label1.Caption = Format(Time, "h:mm:ss AM/PM")
Label1.Width = Me.Width
Label1.Height = Me.Height
Label1.Top = Me.Top
Label1.Left = Me.Left
End Sub

Private Sub Timer1_Timer()
Dim s As String
If InStr(Label1.Caption, ":") > 0 Then
    s = Replace(Label1.Caption, ":", " ", , , vbTextCompare)
    Label1.Caption = s
Else
   Label1.Caption = Format(Time, "h:mm:ss AM/PM")
End If
End Sub












Leaper Year Checker in PHP


In learning computer programming one of the most common programming problem that is being presented by teachers in their students is how to determine whether the given year is a leap year or not. A leap year according is a year that has additional day most of the time it will fall on the month of February commonly the month of February has only 28 days but in leap year with will fall until 29 days. Leap year occurs every fours years their are some sports events that is being held every four years just like the Olympic games and FIBA basketball tournaments. 

Let us start discussing how the program works in our leap year check first of all we need to create our user interface in our web page we are using HTML and CSS to make our layout more presentable and easy to interact with our user. Our program will ask the user to enter the year in the text field after which it will give the user an option to check if the year is a leap year or not. Their are two command button the first one is the convert and the other one is the clear all. The convert button will check if the year given by the user is a leap year or not a leap year and the clear button will allow the user to clear the text fields in order for the user to enter new year.

Again this code that I wrote to check the given year of the user whether it is a leap year or not is intended for beginners in PHP web programming I hope you will find my work useful in your programming assignments and projects.

Thank you very much until the next article.


Sample Output of Our Program


Program Listing

<?php
/* Leap Year Checker
   May 30, 2014 Friday
   Author : Mr. Jake R. Pomperada, MAED-IT
   Email Address: jakerpomperada@yahoo.com

*/   

// Trapping any possible errors
error_reporting(0);

$value1 = trim($_REQUEST['value1']);


function is_leap_year($year)
{
$ts = strtotime("$year-01-01");
return date('L', $ts);
}


  
 // For submit button process of Computation
   
 if ($_REQUEST['convert'])
    {
if (empty($value1)) {
     $message = "Year Cannot Be Empty.";
$solve="";
}
    elseif (!is_numeric($value1))
{
$message = "Year Value Cannot be a String.";
$solve="";
}
elseif ( !is_leap_year($value1) ) 
{
      $output = "$value1 not a leap year.";
      $solve= $output;
     }
   else {
       $output = "$value1 is a leap year.";
      $solve= $output;
     }
 }

 if ($_REQUEST['clear'])
    {
    $value1="";
    $value2="";
$message="";
   }
   
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Roman Numberal Converter</title>
<style type="text/css">
<!--
body {
background-color: #CCFFFF;
}
.style3 {
font-size: 18px;
color: #80FF00;
}
.style5 {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #0000CC;
font-weight: bold;
}
.style10 {
font-size: 16px;
font-weight: bold;
}
.style11 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #0000CC;
}
-->
</style></head>

<body>
<div align="center">
  <p><img src="title.jpg" width="511" height="93" /></p>
  <p class="style5 style10">Created By</p>
  <p class="style5">Mr. Jake R. Pomperada, MAED-IT</p>
  <p class="style5">Email Address: jakerpomperada@yahoo.com</p>
  <form id="form1" name="form1" method="post" action="">
  <table width="450" border="0">
    <tr>
     
 <td width="235"><div align="left"><span class="style5">Please enter a year </span></div></td>
      <td width="205"><label>
        <input type="text" name="value1" maxlength=5
value="<?php echo trim($value1); ?>" />
      </label></td>
 <?php
     echo "<font color=#0000CC><b><h4>".$message."</b></h4></font>";
?>
    </tr>
    <tr>
      <td><div align="left"></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
     
 <td><div align="left" class="style11">The Result is </div></td>
      <td><input type="text" name="value2" maxlength=5 
 value="<?php echo trim($solve); ?>" readonly />
 </td>
    </tr>
    <tr> </tr>
  <td height="26"><p align="justify">
    <input type="submit" name="convert" value="Convert" />
    <input type="submit" name="clear" value="Clear All" />
  </p></td>
  </table>
  </form>
  <p class="style3">&nbsp;</p>
</div>
<p>&nbsp;</p>
</body>
</html>



Simple Calculator in PHP

This simple program in PHP will allow the user to perform basic mathematical operations using PHP as your web scripting programming language it a simple calculator program in PHP. Before we can accept values from the use first we make a web form layout that will accept input values from our user. Their are two text field in HTML the first text field will ask the user to enter the first value and the second text field will ask also the user to enter the first value.

After which our program will give the user to select mathematical operations using the combo box in our web page their are for operations the addtion, subtraction, multiplication and division.If the user select addition the user can click the compute button which will perform the computation and display the results on the web page in the text field. 

This simple calculator program that I wrote is intended for beginners that are new in PHP programming. Based in my experience as a software developer and web developer in learning PHP you must have basic understanding and knowledge in HTML because HTML is the one will accept input values from the user of your program. It will follow the basic understanding how the syntax and commands in PHP making small programming will develop your skills and logic how the program works.

I hope you will find my work useful in your quest in learning PHP as your web scripting programming language.

Thank you very much until the next article.



Sample Output of our Program

Program Listing


<?php
  // Written By: Jake R. Pomperada
  // May 30, 2014 Friday
  // Tools : Wamp Server
  // Email Address: jakerpomperada@yahoo.com
  
  error_reporting(0);
  if ($_REQUEST['clear'])
   {
    
$val_1 ="";
$val_2 ="";
$result ="";
}

   
  if ($_REQUEST['submit']) 
     {
   
$choice = $_REQUEST['choice'];  
 if ($choice == "1")
   {
$val_1 = $_REQUEST['val_1'];
$val_2 = $_REQUEST['val_2'];
$result = $_REQUEST['val_1'] +  $_REQUEST['val_2'];

}
elseif ($choice == "2")
   {
    $val_1 = $_REQUEST['val_1'];
$val_2 = $_REQUEST['val_2'];
$result = $_REQUEST['val_1'] -  $_REQUEST['val_2'];

}
elseif ($choice == "3")
   {
$val_1 = $_REQUEST['val_1'];
$val_2 = $_REQUEST['val_2'];
$result = $_REQUEST['val_1'] *  $_REQUEST['val_2'];
}
elseif ($choice == "4")
   {
$val_1 = $_REQUEST['val_1'];
$val_2 = $_REQUEST['val_2'];
    $result = $_REQUEST['val_1'] /  $_REQUEST['val_2'];
 
  }

?>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div align="center">
  <p><font size="4"><strong>Calculator 1.0</strong></font></p>

<form name="form2" method="post" action="">
    <p align="left">Enter First Number 
      <input type="text" name="val_1" 
 value="<?php echo $val_1; ?>">
  </p>
    <div align="left">Enter Second Number 
      <input type="text" name="val_2" 
 value="<?php echo $val_2; ?>">
 
    </div>

    <p align="left"><strong>Math Operation</strong></p>
    <p align="left"><strong>
    <select name="choice">
<option value="1"> Addition</option>
<option value="2"> Subtration</option>
  <option value="3"> Multiplication</option>
  <option value="4"> Division</option>
</select>
      </strong></p>
     
    <div align="left"><strong>Result</strong> 
      <input type="text" name="result" 
  value="<?php echo $result ?>" readonly>
    </div>
   <input type="submit" name="submit" value="Compute">
    <tr> </tr>  <tr> </tr> 
   <input type="submit" name="clear" value="Clear">

  </form>
 <p>&nbsp;</p>
</div>
</body>
</html>