Sunday, December 11, 2016

Fahrenheit To Celsius Converter in JavaScript

Here is a sample program that I wrote in JavaScript that will ask the user to give temperature in Fahrenheit and then convert into Celsius equivalent.  The code is very simple and easy to understand.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

<html>
<title> Fahrenheit To Celsius Converter 1.0
</title>
<body bgcolor="lightblue">
<font color="black" face="Arial" size="5">
<center>
<br>
 Fahrenheit To Celsius Converter 1.0
<br>
</center>
</font>
<style type="text/css">
.labelText {
 text-align : right;
 padding-right : 3px;
 color   : black;
 font-family:"Arial";
 font-size    : 18px;
}
</style>

 <form  name="temp" method="post">
<table>
<tr>
<tr>
 <td> &nbsp; </td>
 </tr>
<td class="labelText">  Enter Temperature in Fahrenheit

</td>
<td> <input type="text" name="fahr"  size="10"/> </td>
</tr>

 <tr>
 <td> &nbsp; </td>
 </tr>
</td>
<tr>
<td class="labelText">
The result is
</td>
<td> 
<input type="text" name="display"  size="50"/> </td>
 </tr>
  <tr>
 <td> &nbsp; </td>
 </tr>
</td>                   
<td> <input type="button" value="Compute" 
title="Click here to compute the temperature in celsius."
 onClick="compute1()">
</td> 
<td> <input type="button" value="Clear" 
title="Click here to clear the text box."
 onClick="clear_all()">
</td> 

</table>
</font>
</form>
<script language ="javascript">
function compute1()
{
var xval1, solve1,final_result;
var result;
  
value1 = parseInt(document.temp.fahr.value);
              
solve1 = 100/(212-32) * (value1 - 32 )
// For two decimal places convertion
 final_result = Math.round(solve1 * 100) /100;

result = value1 + " fahrenheit is equivalent to " 
               + final_result + " celsius. ";

document.temp.display.value = result;
}

function clear_all()
{
document.temp.fahr.value = "";
document.temp.display.value = "";
document.temp.fahr.focus(); 
}
</script>
</body>
</html>






Area of Rectangle Solver in JavaScript

In this article I would like to share with you a sample program to solve the area of the rectangle using JavaScript. The code is very short and easy to understand I wrote this code using the time I am still working as a college IT instructor.  I hope you will find my work useful. Thank you.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>
<title> Area of a Rectangle Solver 1.0
</title>
<body bgcolor="yellow">
<font color="blue" face="Comic Sans MS" size="5">
<center>
<br>
Area of a Rectangle Solver 1.0   
<br>
</center>
</font>
<style type="text/css">
.labelText {
 text-align    : right;
 padding-right : 3px;
 color         : blue;
 font-family   :"Comic Sans MS";
 font-size     : 18px;
}             
</style>

 <form  name="rectangle" method="post">
<table>
<tr>
<tr>
 <td> &nbsp; </td>
 </tr>
<td class="labelText">  Enter the Width 

</td>
<td> <input type="text" name="width"  size="10"/> </td>
</tr>
 <td class="labelText">  Enter the Height

</td>
<td> <input type="text" name="height"  size="10"/> </td>
</tr>
 <tr>
 <td> &nbsp; </td>
 </tr>
</td>
<tr>
<td class="labelText">
The area of the rectangle is
</td>
<td> 
<input type="text" name="display"  size="10"/> </td>
 </tr>
  <tr>
 <td> &nbsp; </td>
 </tr>
</td>                   
<td> <input type="button" value="Compute" 
title="Click here to compute the area of the rectangle."
 onClick="compute1()">
</td> 
<td> <input type="button" value="Clear" 
title="Click here to clear the text box."
 onClick="clear_all()">
</td> 

</table>
</font>
</form>
<script language ="javascript">
function compute1()
{
var xwidth, xheight, solve;

  
xwidth = parseInt(document.rectangle.width.value);
xheight = parseInt(document.rectangle.height.value);
solve = ( xwidth * xheight);

result = solve+ ".";

document.rectangle.display.value = result;
}

function clear_all()
{
document.rectangle.width.value = "";
document.rectangle.height.value = "";
document.rectangle.display.value = "";
document.rectangle.width.focus(); 
}
</script>
</body>
</html>




Area of the Circle Solver in JavaScript

In this article I would like to a share with you guys a simple program that will ask the use give the area of the circle and then our program will compute the area of the circle using JavaScript as our programming language.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


<html>
<title> Area of a Circle Solver 1.0
</title>
<body bgcolor="lightgreen">
<font color="red" face="Arial" size="5">
<center>
<br>
Area of a Circle Solver 1.0   
<br>
</center>
</font>
<style type="text/css">
.labelText {
 text-align : right;
 padding-right : 3px;
 color   : red;
 font-family:"Arial";
 font-size    : 18px;
}
</style>

 <form  name="circle" method="post">
<table>
<tr>
<tr>
 <td> &nbsp; </td>
 </tr>
<td class="labelText">  What is the area of the circle

</td>
<td> <input type="text" name="area"  size="10"/> </td>
</tr>

 <tr>
 <td> &nbsp; </td>
 </tr>
</td>
<tr>
<td class="labelText">
The result is
</td>
<td> 
<input type="text" name="display"  size="50"/> </td>
 </tr>
  <tr>
 <td> &nbsp; </td>
 </tr>
</td>                   
<td> <input type="button" value="Compute" 
title="Click here to compute the area of the circle."
 onClick="compute1()">
</td> 
<td> <input type="button" value="Clear" 
title="Click here to clear the text box."
 onClick="clear_all()">
</td> 
 
</table>
</font>
</form>
<script language ="javascript">
function compute1()
{
var xval1, solve1,final_result;
var result;
  
value1 = parseInt(document.circle.area.value);
              
solve1 = (3.14159 * value1 * value1);
// For two decimal places convertion
final_result = Math.round(solve1 * 100) /100;

result = value1 + " radius is equivalent to " 
               + final_result + " area of the circle. ";

document.circle.display.value = result;
}

function clear_all()
{
document.circle.area.value = "";
document.circle.display.value = "";
document.circle.area.focus(); 
}
</script>
</body>
</html>



Kilometers To Miles Converter in JavaScript

Here is a sample program that I wrote a long time ago during the time I work as IT instructor in college. This program will ask the user to give a number in kilometers and then our program will convert the given number into miles equivalent using JavaScript.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>
<title> Kilometers to Miles Converter 1.0
</title>
<body bgcolor="black">
<font color="white" face="Arial" size="5">
<center>
<br>
   Kilometers to Miles Converter 1.0
<br>
</center>
</font>
<style type="text/css">
.labelText {
 text-align : right;
 padding-right : 3px;
 color   : white;
 font-family:"Arial";
 font-size    : 18px;
}
</style>

 <form  name="kilo" method="post">
<table>
<tr>
<tr>
 <td> &nbsp; </td>
 </tr>
<td class="labelText">  Enter Number of Kilometers

</td>
<td> <input type="text" name="distance"  size="10"/> </td>
</tr>

 <tr>
 <td> &nbsp; </td>
 </tr>
</td>
<tr>
<td class="labelText">
The result is
</td>
<td> 
<input type="text" name="display"  size="50"/> </td>
 </tr>
  <tr>
 <td> &nbsp; </td>
 </tr>
</td>
<td> <input type="button" value="Compute" 
title="Click here to compute the miles equivalent."
 onClick="compute1()">
</td> 
<td> <input type="button" value="Clear" 
title="Click here to clear the text box."
 onClick="clear_all()">
</td> 

</table>
</font>
</form>
<script language ="javascript">
function compute1()
{
var xval1, solve1,final_result;
var result;
  
value1 = parseInt(document.kilo.distance.value);
              
solve1 = (value1 * 0.621371192);
// For two decimal places convertion
final_result = Math.round(solve1 * 100) /100;

result = value1 + " kilometers(s) is equivalent to " 
               + final_result + " miles(s). ";

document.kilo.display.value = result;
}

function clear_all()
{
document.kilo.distance.value = "";
document.kilo.display.value = "";
document.kilo.distance.focus(); 
}
</script>
</body>
</html>








Addition of Two Numbers in JavaScript

Here is a sample program that I wrote a very long time ago while I'm teaching web programming in college. The program will ask the user to give two numbers and our program will find the sum of two numbers using JavaScript I am using HTML forms to accept values from the user.  I hope you will find my work useful. Thank you.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

<html>
<title> Sum of Two Numbers
</title>
<body bgcolor="lightgreen">
<font color="black" face="Arial" size="5">
<center>
<br>
Sum of Two Numbers
<br>
</center>
</font>
<style type="text/css">
.labelText {
 text-align : right;
 padding-right : 3px;
}
</style>
<form  name="addval" method="post">
<font color="black" face="Arial" size="5">
<table>
<tr>
<td class="labelText">  Enter Value No. 1
</td>
<td> <input type="text" name="val1"  size="10"/> </td>
</tr>
<tr>
<td class="labelText">  Enter Value No. 2
</td>
<td> <input type="text" name="val2" size="10"/> </td>
</tr>
 <td> &nbsp; </td>
<tr>
<td class="labelText">  The Total Sum is
</td>
<td> <input type="text" name="sum" size="10"/> </td>
</tr>
 <tr>
 <td> &nbsp; </td>
 </tr>
<td> <input type="button" value="Compute" 
title="Click here to find the sum."
 onClick="add()">
</td> 
<td> <input type="button" value="Clear" 
title="Click here to clear the text box."
 onClick="clear_all()">
</td> 

</table>
</font>
</form>
<script language ="javascript">
function add()
{
var xval1, xval2, xsum;
  
xval1 = parseInt(document.addval.val1.value);
xval2 = parseInt(document.addval.val2.value);

xsum = (xval1 + xval2);

document.addval.sum.value = xsum;
}

function clear_all()
{
document.addval.val1.value = "";
document.addval.val2.value = "";
document.addval.sum.value = "";
document.addval.val1.focus(); 
}
</script>
</body>
</html>








Armstrong Number Checker in C#

Today I would like to share with you guys a program that is written by a close friend of mind, a fellow software engineer and expert C# developer Mr. Alfel Benvic G. Go he wrote this program we called Armstrong Number Checker using C#. First of all thank you Sir Bon for sharing this program to us. What does the program will do is to ask the user to give a number and then our program will compute the armstrong number based on the given number by our user. Thank you once again Sir Bon for sharing your codes to us.

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

My email address are the following 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.Linq;
using System.Text;

namespace ArmstrongNumber
{
    /*Armstrong number is a number which is equal to sum of digits raise to the power total number of digits in the number. */
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter a Number: ");
            String a = Convert.ToString(Console.ReadLine());
            Int32 size = a.Length;

            Console.WriteLine("Length of the Input Number is = " + size);
            Console.WriteLine("\n");
            Int32 num = Int32.Parse(a);
            Int32 n = num;
            Int32 check = 0, remainder;

            while (num > 0)
            {
                remainder = num % 10;
                check = check + (Int32)Math.Pow(remainder, size);
                num = num / 10;
            }
            if (check == n)
                Console.WriteLine(n + " is an Armstrong Number");
            else
                Console.WriteLine(n + " is not an Armstrong number");
            Console.ReadLine();
        }
    }
}



Pascal Triangle in C#

Today I would like to share with you guys a program that is written by a close friend of mind, a fellow software engineer and expert C# developer Mr. Alfel Benvic G. Go he wrote this program we called Pascal Triangle using C#. First of all thank you Sir Bon for sharing this program to us. What does the program will do is to ask the user to give a number and then our program will generate the corresponding pascal triangle pattern in  C#. I hope you will find the work of Sir Bon useful. Thank you.

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

My email address are the following 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.Linq;
using System.Text;

namespace PascalTriangle
{
    class Program
    {
        static void Main(string[] args)
        {
            Int32 bin;
            Int32 p;
            Int32 q;
            Int32 r;
            Int32 x;

            Console.Write("Enter No of Rows: ");
            r = Convert.ToInt32(Console.ReadLine());
            bin = 1;
            q = 0;


            while (q < r)
            {
                for (p = 40 - 3 * q; p > 0; p--)
                    Console.Write(" ");
                for (x = 0; x <= q; x++)
                {
                    if ((x == 0) || (q == 0))
                        bin = 1;
                    else
                    bin = (bin * (q - x + 1)) / x;
                    Console.Write("      ");
                    Console.Write(bin);
                }
                Console.WriteLine("");
                q++;
            }
            Console.ReadLine();
        }
    }
}