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("");

Feet To Centimeter Converter in Python

A simple program that will ask the user to give a value in feet and then it will convert it in centimeters equivalent using Python as our programming language.

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.




Sample Program Output


Program Listing

print("");
print("Feet To Centimeter Converter");
print("");
feet = input("How many feet(s) : ")
value = float(feet)

def find_centimeters(value):   
    return float(value)* 30.48


print("");

get_result = find_centimeters(value)
final_result = int((get_result * 100) + 0.5) /100.0

print("The equivalent value of ", value, " feet(s) in centimeters is "
      ,final_result,' centimeter(s).')
print("");
print("End of Program")
print("");

Square and Cube Root Solver in Python

A simple program that I wrote using Python as my programming language that will ask the user to give a number and then the program will compute for the square and cube root value of the give number by the user.

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.



Sample Program Output



Program Listing


print("");
print("Square and Cube Root Solver");
print("");
val1 = input("Enter a number  : ")
a = int(val1)

def square(a):   
    return int(a) * int(a)

def cube_root(a):
    return int(a) * int(a) * int(a)

print("");

square_result = square(a)
cube_result = cube_root(a)

print("The square value of ", a, " is " ,square_result,'.')
print("The cube root value of ", a, " is " ,cube_result,'.')
print("");
print("End of Program")
print("");


Sunday, March 13, 2016

Palindrome Checker in C++

A computer has been around for us for a long period of time. We use computers is a wide range of applications such as in business, industry, education, entertainment, weather forecasting, military for example.  It makes our lives easier because most of the tedious task and difficult task is being done by the computer with the use of a computer program. As a programmer our work is very crucial and critical most of the time because we are dealing with important facts and figures all the time one small mistake it can cause tremendous amount of losses on the part of the company or even in an organization we are working with.

Computers at first is designed to perform computations during world war 2 but later years it has been used to manipulate other types of date such as words, sentences, phrase or even paragraphs. In this article I will explain and discuss in detailed one of the most basic string applications written in C++ programming language a program called Palindrome Checker. C++ is one of the most versatile programming language derive from the C language that is introduced in 1972 by Dr. Dennis Ritchie later one as the complexity in software development particularly in system programming. C++ is being developed by Dr. Bjarne Stroustrup to overcome some of the weak point of the C language in 1981 at AT and T laboratories in New Jersey.  The enhancement of C++ library it gives the language more suitable application not only limited in system programming. When we talking about system programming we are referring to writing programs that interacts to the computer hardware such examples is operating systems, compilers and interpreters, antivirus software and system tools to maintain the normal operation of our computers.

So the question is what is a palindrome well a palindrome it refers to word, sentences, phrases, numbers or string when we read it forward and backward the spelling and pronunciation is the same. Example of words that is palindrome by nature is ana, radar, ama, abba to name a few.  In this article in writing our C++ program I will be using CodeBlock text editor and Dev C++ that is already integrated in our CodeBlocks editor.  This two software is open source it means it is free to use and download over the Internet for your own personal use and commercial use also.  You can download CodeBlock in their web address http://www.codeblocks.org/ .

Let us presuming you have already downloaded and installed codeblocks in your computer. The first step is to open our editor and encode the C++ commands. In this program we declare to library file in C++ that standard iostream and string.h. The iostream is one of the very basic library file we use every time we write the C++ program it tells our compiler that we are allowed to use basic input and output commands in C++ such for example cout and cin commands. The next library file that I will discuss is the string.h this library file in C++ is used primarily to include string functions in our program in this program we use the strcpy, strcmpi and strrev functions. The strcpy is a function that will copy the first and second  string variable in our program. The second strcpy command will copy the variable word3 that will act as your temporary folder of a string and  we use the strrev this function will reverse the first string variable in our program. The next part is the use of the  check_same_string = strcmpi(word1,word3); this command tells use the check_same_string is our assignment operator that will hold the compared string of word1 and word3 variables.  In our condition in our program  if (check_same_string == 0) it means that is the both string word1 and word3 are the same they are considered as palindrome if not the word is not a palindrome. Below is the complete program listing of our palindrome checker program.


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.






Sample Program Output


#include <iostream>
#include <string.h>

  using namespace std;


char word1[50],word2[50],word3[50];

int check_same_string=0;

main()
{
    system("cls");
    cout << "\n\n";
    cout << "  ***====Palindrome Checker ====***";
    cout << "\n\n";
    cout << "Enter a Word Please : ";
    gets(word1);
     strcpy(word2,word1);
     strcpy(word3,strrev(word2));
     check_same_string = strcmpi(word1,word3);
      if (check_same_string == 0)

        {
            cout << "\n\n";
            cout << "The word in reversed order is " << word3 << ". \n";
            cout << "It is a Palindrome.";
        }
      else {
            cout << "\n\n";
            cout << "The word in reversed order is " << word3 << ".\n";
            cout << "It is Not a Palindrome.";
        }
     cout << "\n\n\n";
     cout << "\t  Thank You For Using This Program";
     cout << "\n\n";
     system("pause");
}





Celsius To Fahrenheit Converter in AngularJS

A very simple program that I wrote using AngularJS that will ask the user to give the temperature in Celsius and then it will convert it into Fahrenheit equivalent. The code is very simple and easy to understand for anyone interested in AngularJS programming.

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.



Sample Program Output

Program Listing

<html>
<head> 
<title>  Celsius To Fahrenheit Converter in AngularJS </title>
</head>
<script type="text/javascript" src="angular.js"></script>
<script>
var app = angular.module('myApp', []);

app.filter('singleDecimal', function ($filter) {
    return function (input) {
        if (isNaN(input)) return input;
        return Math.round(input * 10) / 10;
    };
});

app.filter('setDecimal', function ($filter) {
    return function (input, places) {
        if (isNaN(input)) return input;
         var factor = "1" + Array(+(places > 0 && places + 1)).join("0");
        return Math.round(input * factor) / factor;
    };
});

app.controller('Ctrl', function ($scope) {
    $scope.val = 1.56;
});
</script>
<style>
p {
   color:blue;
   font-family: "arial";
   font-style: bold;
   font-size: 18px;
  }
  
h3{
   color:red;
   font-family: "arial";
   font-style: bold;
   font-size: 20px;
  }
  
 input[type='text'] 
   { 
   color:blue;
   font-family: "arial";
   font-size: 18px;
   font-style: bold;
   }
 </style>
 <body bgcolor="yellow">
<br><br>
<h3> Celsius To Fahrenheit Converter in AngularJS</h3>
<div ng-app="myApp">
    <p>Enter temperature in Celsius :
        <input type="text" ng-model="fahrenheit" maxlength="5" size="3"/>
    </p><br>

    <p>The temperature in celsius is {{ fahrenheit }}&degC its equivalent to fahrenheit is {{ (fahrenheit * 9/5) + 32 | setDecimal:1}}&degF.</p>
</div>.
</body>
</html>




Fahrenheit to Celsius Converter in AngularJS

A very simple program that I wrote using AngularJS that will ask the user to give the temperature in fahrenheit  and then it will convert it into celsius equivalent. The code is very simple and easy to understand for anyone interested in AngularJS programming.

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.




Sample Program Output


Program Listing


<html>
<head> 
<title> Fahrenheit to Celsius Converter in AngularJS </title>
</head>
<script type="text/javascript" src="angular.js"></script>
<script>
var app = angular.module('myApp', []);

app.filter('singleDecimal', function ($filter) {
    return function (input) {
        if (isNaN(input)) return input;
        return Math.round(input * 10) / 10;
    };
});

app.filter('setDecimal', function ($filter) {
    return function (input, places) {
        if (isNaN(input)) return input;
         var factor = "1" + Array(+(places > 0 && places + 1)).join("0");
        return Math.round(input * factor) / factor;
    };
});

app.controller('Ctrl', function ($scope) {
    $scope.val = 1.56;
});
</script>
<style>
p {
   color:blue;
   font-family: "arial";
   font-style: bold;
   font-size: 18px;
  }
  
h3{
   color:red;
   font-family: "arial";
   font-style: bold;
   font-size: 20px;
  }
  
 input[type='text'] 
   { 
   color:blue;
   font-family: "arial";
   font-size: 18px;
   font-style: bold;
   }
 </style>
 <body bgcolor="yellow">
<br><br>
<h3>Fahrenheit to Celsius Converter in AngularJS</h3>
<div ng-app="myApp">
    <p>Enter temperature in Fahrenheit :
        <input type="text" ng-model="fahrenheit" maxlength="5" size="3"/>
    </p><br>

    <p>The temperature in fahrenheit is {{ fahrenheit }}&degF its equivalent to celsius is {{ (fahrenheit - 32) * 5/9 | setDecimal:1}}&deg C.</p>
</div>.
</body>
</html>





Kilograms To Pounds Converter in AngularJS

A very simple program that I wrote using AngularJS that will ask the user to give the weight in kilograms and then it will convert it into pounds equivalent. The code is very simple and easy to understand for anyone interested in AngularJS programming.

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.



Sample Program Output

Program Listing

<html>
<head> 
<title> Kilograms To Pounds Converter in AngularJS </title>
</head>
<script type="text/javascript" src="angular.js"></script>
<script>
var app = angular.module('myApp', []);

app.filter('singleDecimal', function ($filter) {
    return function (input) {
        if (isNaN(input)) return input;
        return Math.round(input * 10) / 10;
    };
});

app.filter('setDecimal', function ($filter) {
    return function (input, places) {
        if (isNaN(input)) return input;
         var factor = "1" + Array(+(places > 0 && places + 1)).join("0");
        return Math.round(input * factor) / factor;
    };
});

app.controller('Ctrl', function ($scope) {
    $scope.val = 1.56;
});
</script>
<style>
p {
   color:blue;
   font-family: "arial";
   font-style: bold;
   font-size: 18px;
  }
  
h3{
   color:red;
   font-family: "arial";
   font-style: bold;
   font-size: 20px;
  }
  
 input[type='text'] 
   { 
   color:blue;
   font-family: "arial";
   font-size: 18px;
   font-style: bold;
   }
 </style>
 <body bgcolor="yellow">
<br><br>
<h3>Kilograms To Pounds Converter in AngularJS</h3>
<div ng-app="myApp">
    <p>How many kilograms :
        <input type="text" ng-model="kilograms" maxlength="5" size="3"/>
    </p><br>
    <p>The weight in kilogram(s) is {{kilograms}} kg(s) its equivalent in pounds is {{ kilograms * 2.20462262 | setDecimal:0 }} lbs.</p>
</div>.
</body>
</html>