Sunday, February 7, 2016

Basic Math Operations in Python

This is a simple program that I wrote using Python as my programming language that program will ask the user to give two numbers and then our program will find the sum, difference, product and quotient of the two numbers that is being provided by our end user of the program. I am still a beginner in Python programming but I find Python an easy to learn 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('\n')
print('\t Basic Math Operations in Python')
print('\n')
first_value  = int(input('Enter first  value : '))
second_value = int(input('Enter second value : '))

addtion = (first_value + second_value)
subtraction = (first_value - second_value)
product = (first_value * second_value)
division = (first_value / second_value);

print('\n')
print("The sum of {0} and {1} is {2} .".format(first_value,second_value,addtion)."\n");
print("The difference between {0} and {1} is {2} .".format(first_value,second_value,subtraction)."\n");
print("The product of {0} and {1} is {2} .".format(first_value,second_value,product)."\n");
print("The quotient of {0} and {1} is {2} .".format(first_value,second_value,division)."\n");
print('\n')
print('Thank you for using this program')





Saturday, February 6, 2016

Checking Prime Number in C++

Here is a sample program that I wrote a long time ago in C++ to check for prime numbers. I have a very busy schedule at work that why I was not able to update my blog. Anyway I hope you will find my work useful in your programming assignments in C++ programming.

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

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream.h>


 int check_prime(int x)
 {
 int var1=0,var2=0,flag=0;
 cout << "\n\n";
 cout << "\t List of Prime Numbers";
 cout << "\n\n";
 for(var1 = 2; var1 <= x; var1++){
flag = 1;
for(var2 = 2; var2 < var1; var2++){
if((int)var1 % (int)var2 == 0){
flag = 0;
}
}

if(flag == 1){
cout << var2;
cout << " ";
}
}
 }
 main(){


   int values=0;
   cout << "\t\tPrime Number Generator Version 1.0";
   cout << "\n\n";
   cout << "Enter a Number : ";
   cin >> values;

   check_prime(values);
cout << "\n\n";
system("pause");
}

Sunday, January 24, 2016

Reading in a Text File in C++

A simple program that I wrote before in C++ to read a text file. The code is very short and easy to understand.

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

My mobile number here in the Philippines is 09173084360.


Program Listing


#include <iostream>
#include <fstream>

using namespace std;

main() {

     string line;
     ifstream a("test.txt");

     while(!a.eof()) {
         if (a.is_open() == false) {
             cout << "Unable to open the file";
             break;
         }
         getline(a,line);
         cout << "\n" << line;
     }


     a.close();
     cout << "\n\n";
     system("pause");
}


Writing in a text file using C++

Here is a sample program that I wrote a long time ago to write the content in a text file using C++. The code is very simple and easy to understand.  

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

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <fstream>

using namespace std;

main() {
     string name,course, school, position;
     int age=0;

     cout << " ======= Resume Maker Version 1.0 =============";
     cout << "\n\n";

     cout << "Enter the name of the Person : ";
     getline(cin,name);
     cout << "Enter the age of the Person : ";

     cin >> age;

     cout << "Enter the course of the Person : ";
    cin.ignore(80,'\n');
    getline(cin,course);

     cout << "Enter the school Graduated  : ";
     getline(cin,school);
     cout << "Enter the Position Applying : ";
     getline(cin,position);

     cout << "\n\n";
     cout << "\t  RECORDS HAS BEEN SAVED IN THE DATABASE";

    ofstream my_file("resume.txt");
    my_file << "\n\n\t\t ==== RESUME VITAE ==== ";
    my_file << "\n\n";
    my_file << "\n \t Name      :  " <<name;
    my_file << "\n \t Age       :  " <<age;
    my_file << "\n \t Course    :  " <<course;
    my_file << "\n \t School    :  " <<school;
    my_file << "\n \t Position  :  " <<position;

    my_file.close();
    return 0;
}






Crud with Grid in PHP and MySQL

A program that is being provided by my bestfriend and fellow software engineer Mr. Dave Marcellana. This program is a CRUD application with grid in PHP and MySQL. I hope you will find the work of Dave useful in your learning PHP programming.

Thank you and God Bless.

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

My mobile number here in the Philippines is 09173084360.



Sample Program Output




Point of Sale (POS) in Visual Basic 6

A Point of Sale Software written by my best friend and fellow software engineer named Mr. Dave Marcellana using Microsoft Visual Basic 6.  I hope you will find his work useful.

Thank you and God Bless.

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

My mobile number here in the Philippines is 09173084360.





Sample Program Output






Sunday, January 17, 2016

Closing Web Page in JavaScript

A simple code that I wrote in JavaScript that enables the use to close the webpage using JavaScript. The code is very simple and easy to understand.

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

My mobile number here in the Philippines is 09173084360.


Sample Program Output


Program Listing

<html>
<head>
<title>Phofile Records in Javascript </title>
<script language = "Javascript">
function func_close()
{
window.close();
var feature = "status = off, menubar = off, location = off, toolbar = off, height = 500, width = 500, top = 20, left = 150";
}
</script>
</head>

<body bgcolor = "lightgreen" text = "blue">
<center>
<img src = "garnet1.jpg" alt = "logo" width = "25%" height = "35%">
<hr size = 4 color = "blue" width = "75%">
<table>
<tr>
<td width = "50%"> <b> STUDENT'S NAME: </b>
<td> <b> Alice Maria Sandoval</b>
</tr>
<tr>
<td> <b> COURSE CODE: </b>
<td> ABC102 - J05 
</tr>
<tr>
<td> <b> SCHEDULE: </b>
<td> TTh / 3 - 6 PM
</tr>
<tr>
<td> <b> SOC: </b>
<td> October 1, 2016
</tr>
<tr>
<td> <b> EOC: </b>
<td> December 31, 2016
</tr>
</table>
<hr size = 4 color = "blue" width = "75%">
<form name = "aboutme">
<input type = "button" name = "close_but" value = "Close" ONCLICK = "func_close();">
</center>

</body>
</html>



Highest and Lowest Number Checker in PHP

A simple program that I wrote in PHP that will determine the highest and lowest number from the given six numbers given by the user. I don't use any built in function in PHP like max() and min() to check for highest and  lowest number. I hope you will find my work useful in your learning PHP 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


<?php
error_reporting(0);
$a= $_POST['val_1'];
$b= $_POST['val_2'];
$c= $_POST['val_3'];
$d= $_POST['val_4'];
$e= $_POST['val_5']; 
$f= $_POST['val_6']; 

 if(isset($_POST['clear']))
$a=""; $b=""; $c=""; $d=""; $e=""; $f="";
$highest_number="";  $lowest_number="";
}
?>

<html>
<head>
<title>Highest and Lowest Number Checker in PHP</title>
<style>
body { font-family:arial;}
form { width: 400px; }
label { float: left; width: 120px; }
.clear { clear: both; height: 0; line-height: 0; }
.floatright { float: right; }
</style>
</head>
<body>
<h2>Highest and Lowest Number Checker in PHP</h2>
<form  action="" method="post">
<label>Item Number 1 : </label> <input type="text" name="val_1" value="<?php echo $a; ?>" size="5" maxlength="5"  autofocus/><br/><br>
<label>Item Number 2 : </label> <input type="text" name="val_2" value="<?php echo $b; ?>" size="5" maxlength="5"/><br/><br>
<label>Item Number 3 : </label> <input type="text" name="val_3" value="<?php echo $c; ?>" size="5" maxlength="5"/><br/><br>
<label>Item Number 4 : </label> <input type="text" name="val_4" value="<?php echo $d; ?>"size="5" maxlength="5"/><br/><br>
<label>Item Number 5 : </label> <input type="text" name="val_5" value="<?php echo $e; ?>"size="5" maxlength="5"/><br/><br />
<label>Item Number 6 : </label> <input type="text" name="val_6" value="<?php echo $f; ?>"size="5" maxlength="5"/><br/><br />
<input type="submit" value="Ok" name="check" title="Click here to check for the highest and lowest number."/>
&nbsp;&nbsp;&nbsp;
<input type="submit" value="Clear" name="clear" title="Click here to clear the text box." />
</form>

<?php
   
if(isset($_POST['check']))

  $arr = array($a,$b,$c,$d,$e,$f);

 $max =$arr[0];
 $min = $arr[0];

foreach($arr as $key => $val){
    if($min > $val){
        $min = $val;
    }
  if($max < $val){
        $max = $val;
    }
}

  $highest_number  = "The Highest Number is " .$max.".<br>";
  $lowest_number = "The Lowest Number is " .$min.".";
  
  echo "<br><br>";
  echo "<b>".$highest_number."</b>"."<br>";
  echo "<b>".$lowest_number."</b>";

}

?>
</body>
</html>

Sunday, January 10, 2016

Average Grade Solver in JavaScript

A simple program that I wrote in JavaScript to solve the average grade of the student based on the subjects the students taken that program also gives remarks whether the student pass or failed in the average grade. The program is very useful for those who wants to learning JavaScript 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.


Program Listing


<html>
<head>
<title>Average Grade Solver in JavaScript </title>
                <h1> Average Grade Solver in JavaScript </h1>
<script language = "Javascript">

function Average(eng,math,theo,sci,his)
{
ave = (eng+math+theo+sci+his)/5;
return(ave);
}
var studname = prompt ("Enter Student Name:","");
var gr_eng = parseInt (prompt ("Enter grade in English:"," "));
var gr_math = parseInt (prompt ("Enter grade in Math:"," "));
var gr_theo = parseInt (prompt ("Enter grade in Theology:"," "));
var gr_sci = parseInt (prompt ("Enter grade in Science:"," "));
var gr_his = parseInt (prompt ("Enter grade in History:"," "));
var ave=Average(gr_eng,gr_math,gr_theo,gr_sci,gr_his);

document.write ("<center><h1> STUDENT GRADE SHEET </h1><hr width='75%' color='blue' size='3'>");
document.write ("<table><tr><td>Student<td>Name:<td><b>",studname,"</b>");
document.write ("<tr><td><b><u>Subject:</b></u><td><br>");
document.write ("<tr><td><br><td> English:<td>",gr_eng);
document.write ("<tr><td><br><td> Math:<td>",gr_math);
document.write ("<tr><td><br><td> Theology:<td>",gr_theo);
document.write ("<tr><td><br><td> Science:<td>",gr_sci);
document.write ("<tr><td><br><td> History:<td>",gr_his);
document.write ("<tr><td>Average<td>Grade:<td><b><p>",ave,"</b>");
if (ave >= 75)
{
status = "Passed";
}
else
{
status = "Failed";
}
document.write ("<tr><td>Status:<td><br><td><b>",status,"</b></table><hr width=75% color='blue' size=3>"); 
</script>
</head>

<body bgcolor = "green" text = "white">

</body>
</html>


Saturday, January 9, 2016

Total Product Cost Solver in C++

This sample program will compute for the total cost of products purchase in a grocery store using C++ 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.


Program Listing

#include <iostream>
#include <iomanip>

using namespace std;

main() {

    string products[50];
    int values=0;
    float item_price[50];
    int total_cost=0,paid=0;
    float tax = 0.12,solve=0.00,tax_solve=0.00;
    float final_cost=0.00;
    cout << "\n\t\t ABC Grocery Store";
    cout << "\n\n";
    cout << "How many items : ";
    cin >> values;
     for (int x=1; x<=values; x++)
       {
           cout << setprecision(2) << fixed;
           cout << "\n\n";
           cout << "Item Name  : ";
           cin >> products[x];
           cout << "Item Price : ";
           cin >> item_price[x];
           total_cost+= item_price[x];
           cout << "\n";
           cout << "Sub-Total Cost $ " << total_cost;

       }
      cout << "\n\n";

       tax_solve = ( total_cost * tax);
        final_cost = (total_cost + tax_solve);
      cout << setprecision(2) << fixed;
      cout << "\nVAT 12%     $ " <<tax_solve;
       cout << "\nTotal Cost $ " << final_cost;
       cout << "\n";
       cout << "\nEnter  amount Paid  $ ";
      cin >> paid;
      solve = (paid - final_cost);
      cout << "\n\n";
      cout << "Amount Change $ " << solve;

     cout << "\n\n";
     system("pause");
}