Thursday, March 31, 2016

Simple Leap Year Checker in JavaScript

Here is a very simple leaper year checker that I wrote using JavaScipt as my programming language. The code is very ideal for beginners in JavaScript Programming.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Program Listing

<html>
<head>
  <title>Simple Leap Year Checker in JavaScript</title>
  <script language = "JavaScript">
    x=1900;
str=x+" is a ";
str1="";
if (x%400==0)
 str1="leap year";
else if (x%4==0 && x%100!=0)
 str1="leap year";
else
 str1="not a leap year";
document.write(str+str1);
  </script>
</head>
</html>


Getting User Input From JavaScript

A simple program that I wrote using JavaScript that shows how get input values from the user using text box in HTML and submit those values using buttons in HTML into JavaScript. I intended my work for beginners in JavaScript programming this code is most common problem encounters by beginners in JavaScript. I hope this simple code will help them getting started.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>

<style>
body {
font-family:arial;
  font-size:20px;
  font-weight:bold;
  color:blue;
}
p {
  font-family:arial;
  font-size:20px;
  font-weight:bold;
  color: green;
  }
</style>  
<body>
Enter your name
<input type="text" id="name" size="20" maxlength="20" required>
<br><br>
<button onclick="Greet(this);"> Ok </button> &nbsp;&nbsp;&nbsp;&nbsp;
<button onclick="Clear(this);"> Clear </button>
<br>
<p id="display"> </p>

<script>
function Greet(field)
{
var hello;
var field = document.getElementById('name');

if (field.value == '') {
 alert("Field is empty");
 document.getElementById('name').value="";
 document.getElementById('name').focus();
 }
 else {
 hello = "Hello " + field.value;
 document.getElementById("display").innerHTML = hello;
  }
}

function Clear(field)
{
var hello;
var field = document.getElementById('name');

if (field.value == '') {
 alert("Field is empty");
 document.getElementById('name').value="";
 document.getElementById('name').focus();
  }
 else { 
 document.getElementById('name').value =" ";
 document.getElementById("display").innerHTML = "";
 document.getElementById('name').focus();
 }
}
</script>
</body>
<html>


Math Calculator in JavaScript

A simple math calculator that I wrote using JavaScript as my programming language what the program does is that it will ask the user to give two integer number and then our program will find the sum, difference, product and quotient of the two number given by the user.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>
<style>
body {
  background-color:lightgreen;
  font-family:arial;
  font-size:20px;
  font-weight:bold;
  color:blue;
}
p {
  font-family:arial;
  font-size:20px;
  font-weight:bold;
  color: blue;
  }
  
div.text { 
  margin: 0; 
  padding: 0; 
  padding-bottom: 1.25em; 

div.text label { 
  margin: 0; 
  padding: 0; 
  display: block; 
  font-size: 100%; 
  padding-top: .1em; 
  padding-right: 2em; 
  width: 8em; 
  text-align: right; 
  float: left; 

div.text input, 
div.text textarea { 
  margin: 0; 
  padding: 0; 
  display: block; 
  font-size: 100%; 

input:active, 
input:focus, 
input:hover, 
textarea:active, 
textarea:focus, 
textarea:hover { 
  background-color: lightyellow; 
  border-color: yellow; 

</style>  
<body><br>
<h2 align="left"> Simple Math Calculator </h2>
<br>
<div class="text"> 
    <label for="val1">Item Value No. 1</label> 
    <input type="text" size="5" name="val1" id="val1" maxlength="5"/> 
</div> 

<div class="text"> 
    <label for="val2">Item Value No. 2</label> 
    <input type="text" size="5" name="val2" id="val2" maxlength="5"/> 
</div> 
<button onclick="compute()" title="Click here to find the result."> Ok </button> &nbsp;&nbsp;&nbsp;&nbsp;
<button onclick="clear_all()" title="Click here to clear the text fields."> Clear </button>
<br><br><br>
<p id="display1"> </p>
<p id="display2"> </p>
<p id="display3"> </p>
<p id="display4"> </p>

<script>
function compute()
{

var val1 = document.getElementById('val1').value;
var val2 = document.getElementById('val2').value;

var sum = parseInt(val1) + parseInt(val2);
var subtract = parseInt(val1) - parseInt(val2);
var product = parseInt(val1) * parseInt(val2);
var quotient = parseInt(val1) / parseInt(val2);


 document.getElementById("display1").innerHTML = "The sum of " + val1 + " and " + val2 + " is " + sum + ".";
 document.getElementById("display2").innerHTML = "The difference between " + val1 + " and " + val2 + " is " + subtract + ".";
 document.getElementById("display3").innerHTML = "The product between " + val1 + " and " + val2 + " is " + product + ".";
 document.getElementById("display4").innerHTML = "The quotient between " + val1 + " and " + val2 + " is " + quotient + ".";

}

function clear_all()
{
document.getElementById("display1").innerHTML ="";
document.getElementById("display2").innerHTML ="";
document.getElementById("display3").innerHTML ="";
document.getElementById("display4").innerHTML =""; 
document.getElementById("val1").value="";
document.getElementById("val2").value="";
document.getElementById("val1").focus();
}
</script>
</body>
<html>




Thursday, March 24, 2016

Function with Parameters in JavaScript

A simple program that I have written using JavaScript that will accept a name of a person and it will be display using alert message box in JavaScript using functions with parameters.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Program Listing



<html>
<body>
<script>

function myfunction(name)
{
 alert("Hello " + name + " How are you? ");
}
</script>
What is your name
<input type="text" value="" id="user" size="20">
<br><br>
<button onclick="myfunction(user.value)"> 
Ok </button>


</body>
</html>


Sunday, March 20, 2016

Addition of Five Numbers in C#

A simple program that I wrote using C# that will ask the user to give five numbers and then the program will find the total sum of five numbers given by the user. The code is very easy to understand and use.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.button1, "Click here to find the sum of five numbers.");
            ToolTip1.SetToolTip(this.button2, "Click here to clear textbox.");
            label6.Visible = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int values1 = Convert.ToInt32(textBox1.Text);
            int values2 = Convert.ToInt32(textBox2.Text);
            int values3 = Convert.ToInt32(textBox3.Text);
            int values4 = Convert.ToInt32(textBox4.Text);
            int values5 = Convert.ToInt32(textBox5.Text);

            int total_sum = (values1+values2+values3+values4+values5);
            label6.Visible = true;
            label6.Text = "The sum of " + values1.ToString() + "," + values2.ToString() + ", " + " "
                        + values3.ToString() + ", " + values4.ToString() + " and " + values5.ToString() +
                        " is " + total_sum + ".";

        }

        private void button2_Click(object sender, EventArgs e)
        {
            label6.Text = "";
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox1.Focus();
        }
    }
}


Odd and Even Number Checker in C#

In this sample program I wrote using Microsoft C# it will ask the user to give a number and then our program will check and determine whether the given number is odd or even.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.button1, "Click here to find out if number is ODD or EVEN number.");
            ToolTip1.SetToolTip(this.button2, "Click here to clear textbox.");
            label3.Visible = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int values = Convert.ToInt32(textBox1.Text);


           if (values % 2 == 0)
            {

                label3.Visible = true;
                label3.Text ="The number " + " " + values.ToString() + " is an EVEN number.";
            }
            else
            {
                label3.Visible = true;
                label3.Text = "The number " + " " + values.ToString() + " is an ODD number.";
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            label3.Text = "";
            textBox1.Text = "";
            textBox1.Focus();
        }
    }
}



Saturday, March 19, 2016

Student Information System in CodeIgniter

Here is a sample program that I wrote in CodeIgniter as very popular PHP framework that demostrate CRUD application I called this program Student Information System in CodeIgniter that will manage the contact information of the students like name, course, home address, telephone numbers and email address. I hope you will find my work useful in learning CodeIgniter.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output



Fibonacci Sequence in Python

A program that will ask the user to give an integer number value and then it will generate the corresponding fibonacci number using Python as my programming language.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


def fibonacci_sequence(values):
  
   if values <= 1:
       return values
   else:
       return(fibonacci_sequence(values-1) + fibonacci_sequence(values-2))


print("-" * 30)
print(" FIBONACCI SEQUENCE PROGRAM ")
print("-" * 30)
items = int(input("Enter an Integer Number : "))


if items <= 0:
   print("Plese enter a positive integer")
else:
   print("The result is :")
   for a in range(items):
       print(fibonacci_sequence(a))
  




Multiplication Table in Python

A simple program that I wrote using Python as my programming language that will generate a multiplication table. The code is very short and easy to understand.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

a = 1
print("-" * 60)
print("\t\t\t MULTIPLICATION TABLE ")
print("-" * 60)
while a < 13:
    n = 1
    while n <= 12:
        print("%4d" % (a * n), end=' ')
        n += 1
    print()
    a += 1
print("-" * 60)




Thursday, March 17, 2016

Celsius To Fahrenheit Converter Using Functions in Python

A program that I wrote using Python as my programming language that will ask the user to give a temperature value in Celsius and then it will convert it to Fahrenheit equivalent using functions in Python.


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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

print("");
print("Celsius To Fahrenheit Converter");
print("");
celsius = input("Enter temperature in Celsius : ")
temp = int(celsius)

def find_fahrenheit(temp):   
    return ((9.0/5.0) * float(temp)+32)

print("");

get_result = find_fahrenheit(temp)
final_result = int((get_result * 100) + 0.5) /100.0

print("The temperature ", temp, " in Celsius "
      ,final_result,' in Fahrenheit.')
print("");
print("End of Program")
print("");



Fahrenheit To Celsius Converter Using Functions in Python

A program that I wrote using Python as my programming language that will ask the user to give a temperature value in Fahrenheit and then it will convert it to Celsius equivalent using functions in Python.

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

print("");
print("Fahrenheit To Celsius Converter");
print("");
fahrenheit = input("Enter temperature in Fahrenheit : ")
temp = int(fahrenheit)

def find_celsius(temp):   
    return (float(temp)-32) * 5.0/9.0

print("");

get_result = find_celsius(temp)
final_result = int((get_result * 100) + 0.5) /100.0

print("The temperature ", temp, " in Fahrenheit "
      ,final_result,' in Celsius.')
print("");
print("End of Program")
print("");





Average of Three Numbers in Python

A very simple program that I wrote using Python as my programming language that will ask the user to give three integer number and then our program will find the average of the three number previously given by our user. 

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

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

print("Average of Three Numbers");
print("");
val1 = input("Enter a first number  : ")
x = int(val1)
val2 = input("Enter a second number : ")
y = int(val2)
val3 = input("Enter a third number  : ")
z = int(val3)

average = (x+y+z) /3
ave = int((average * 100) + 0.5) /100.0
print("");
print("The average of ", x, ",", y," and ", z, " is ",ave,".")
print("");
print("End of Program")




Count Capital and Small Letters in Python

A program that I wrote using Python that will ask the user to give a word and then our program will count how many upper case and lower case letters can be found in the give word by the user. The code is very short and easy to understand.

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

My mobile number here in the Philippines is 09173084360.


Program Listing


print("");
print("Count Capital and Small Letters in a Word");
print("");
word = input("Kindly give a word : ")

print("No. of Capital Letters: ", sum(1 for a in word if a.isupper()))
print("No. of Lower Letters: ", sum(1 for a in word if a.islower()))
print("");
print("End of Program")
print("");