Wednesday, August 1, 2018

Positive and Negative Number Checker Version 2 in JavaScript

Here is the version two of my program to check if the given number in JavaScript is a positive or negative number.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.





Sample Program Output


Program Listing

index.htm

<html>
<head>
<style>
    body {
      font-family:arial;
  background-color:lightgreen;
  font-size:24px;
  font-weight:bold;
      }
</style>
<script>
function num()
{
var no;

no=Number(document.getElementById("no_input").value);

if (no==0) {
alert("The given number " + no + " is positive number.");
document.getElementById("no_input").value="";
document.getElementById("no_input").focus();
}
else if (no>=1) {
 alert("The given number " + no + " is positive number.");
 document.getElementById("no_input").value="";
 document.getElementById("no_input").focus();
}
else
{
 alert("The given number " + no + " is negative number.");
 document.getElementById("no_input").value="";
 document.getElementById("no_input").focus();
}

}
</script>
</head>
<body>
<br>
<h2> Positive and Negative Number Checker </h2>
<br>

Enter any Number: <input id="no_input">
<button onclick="num()">Check</button></br></br>
</body>
</html>


Prompt JavaScript Calculator

In this article I would like to show you how to create a prompt JavaScript calculator. Our program is very simple it will ask the user to give the first value, the second is the operator  addition, subtraction, multiplication and division and then the second value. Our program will display the result on the screen using if else statement in JavaScript.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.



Sample Program Output


Program Listing

index.htm

<html>
  <head>
  <title> JavaScript Calculator </title>
  </head>
  <style>
    body {
      font-family:arial;
  background-color:lightgreen;
  font-size:24px;
  font-weight:bold;
      }
</style>
 <body>
   <script>
      var a = parseInt(prompt("Give first value"));
  var opt= prompt("Give operator");
  var b = parseInt(prompt("Give second value"));
 
  if (opt =='+') {
    add = (a+b);
document.write("The sum of " + a + " and " 
    + b  + " is " + add + ".");
  }
  else if  (opt =='-') {
    sub = (a-b);
document.write("The difference of " + a + " and " 
    + b  + " is " + sub + ".");
  }
  else if  (opt =='*') {
    mul = (a*b);
document.write("The product of " + a + " and " 
    + b  + " is " + mul + ".");
  }
  else if  (opt =='/') {
    div = (a/b);
document.write("The quotient of " + a + " and " 
    + b  + " is " + div + ".");
  }
  else {
    document.write("Invalid Operation !!!");
  }
</script>
  
  </body>
  
 </html>




Sunday, July 29, 2018

Salary Range Checker in C++

In this article I would like to share a sample program that will demonstrate how to use if  - else if statement in C++. I also added exception handling capabilities that will only accept numbers as input values in our program using limits library in C++. I hope you will find my work useful. I am using Dev C++ in developing this program.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.






Sample Program Output


Program Listing

salary.cpp

// salary.cpp
// written by Mr. Jake R. Pomperada, MAED-IT
// July 29, 2018 Sunday



#include <iostream>
#include<limits>

using namespace std;

int main()
{
int salary=0;
char reply;
do {
system("cls");
cout << "\n\n";
cout <<"\tSalary Range Checker in C++";
cout <<"\n\n";
cout << "\tCreated By Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\n";
cout << "\tWhat is your salary : ";
while(!(cin >> salary)){
        cin.clear();
        cin.ignore(numeric_limits<streamsize>::max(), '\n');
        cout << "\tInvalid input.  Try again: ";
        cout << "\n\n";
         cout << "\tWhat is your salary : ";
    }
     if (salary <=0) {
cout <<"\n\n";
cout <<"\tYour salary ranges is very small. Try Again";
}
else if (salary >= 1 && salary <= 999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 1 to PHP 999.";
}
else if (salary >= 1000 && salary <= 5999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 1,000 to PHP 5,9999.";
}
else if (salary >= 6000 && salary <= 10999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 6,000 to PHP 10,999.";
}
else if (salary >= 11000 && salary <= 15999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 11,000 to PHP 15999.";
}
else if (salary >= 16000 && salary <= 20000) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 16,000 to PHP 20,000.";
}
else
{
cout <<"\n\n";
cout <<"\tYour is above P20,000 and beyond.";
}
cout <<"\n\n";
cout << "\tDo you want to continue (Y/N)? : ";
    cin >> reply;
} while (reply=='Y' || reply=='y');
  cout << "\n\n";
  cout << "\tThank you for using this software";
  cout <<"\n\n";
  cout << "\tEnd of Program";
  cout <<"\n\n";
}





Thursday, July 26, 2018

Student Database Grading System in C++

In this article I would like to share with you a database system that I wrote in C++ and my back end is binary file in C++ that has a function to add,edit, view and delete the record of the student. It has also a function to compute the student grades. 

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.



Sample Program Output



Program Listing

student.cpp

// student.cpp
// Written By Mr. Jake R. Pomperada, BSCS, MAED-IT
// July 26, 2018  Thursday
// Bacolod City, Negros Occidental Philippines

#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>

 using namespace std;


int main( )
{
FILE *fp, *ft ;
char another, choice ;
struct student
{
char stud_id_no[300];
char name[300];
char course[300];
char subject[300];
float prelim,midterm,endterm,final_grade;
} ;
struct student grade;
char student_id[300];
long int recsize;
    int flag=0;
fp = fopen ("GRADE_DB.DAT", "rb+" ) ;
if ( fp == NULL )
{
fp = fopen ( "GRADE_DB.DAT", "wb+" ) ;
if ( fp == NULL )
{
puts ( "Cannot open file" ) ;
exit(0) ;
}
}
recsize = sizeof ( grade ) ;
while ( 1 )
{
       system("CLS");
         setprecision(0);
        cout <<"\n";
cout << "\n============================================";
cout <<"\n";
cout <<"\n STUDENT GRADING DATABASE SYSTEM IN C++";
cout <<"\n";
cout << " Created By Mr. Jake R. Pomperada, MAED-IT";
cout <<"\n=============================================";
cout <<"\n\n";
cout << "1. INSERT STUDENT RECORD";
cout <<"\n";
cout << "2. BROWSE STUDENT RECORD";
cout <<"\n";
cout << "3. EDIT STUDENT RECORDS" ;
cout <<"\n";
cout  << "4. FIND STUDENT RECORDS";
cout <<"\n";
cout << "5. REMOVE STUDENT RECORDS";
cout <<"\n";
cout  << "6. QUIT PROGRAM" ;
cout <<"\n\n";
cout  <<"SELECT YOUR OPTION :=> ";
fflush (stdin) ;
choice = getche() ;
switch ( choice )
{
case '1' :
fseek ( fp, 0 , SEEK_END ) ;
another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
cout <<"\n\n";
cout << "=== INSERT NEW STUDENT GRADE RECORD ===";
cout <<"\n\n";
cout <<"Enter Student ID Number : ";
                    cin >> grade.stud_id_no;
cout << "Enter Student Name: ";
fflush (stdin) ;
gets(grade.name);
cout <<"Enter Course : ";
fflush (stdin) ;
gets(grade.course);
                    cout <<"Enter Subject : ";
fflush (stdin) ;
gets(grade.subject);
cout <<"Enter Prelim Grade: ";
cin >> grade.prelim;
cout << "Enter Midtem Grade: ";
cin >> grade.midterm;
cout << "Enter Endterm Grade: ";
cin >> grade.endterm;
grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
cout << "\n";
                    cout << "\n Student Final Grade : "  << round(grade.final_grade);
fwrite (&grade, recsize, 1, fp ) ;
cout << "\n\n";
cout  << "\nAdd New Student Record (Y/N) : " ;
fflush (stdin) ;
another = toupper(getche()) ;
}
break ;
case '2' :
        system("cls");
rewind ( fp );
cout << "\n\n";
                cout <<"=== VIEW STUDENT GRADE RECORD ===";
                cout <<"\n\n";
while ( fread ( &grade, recsize, 1, fp ) == 1 )
        {
       cout <<"\n";
       cout <<"\n  ID Number        : " <<grade.stud_id_no;
       cout <<"\n  Name             : " <<grade.name;
       cout <<"\n  Course           : " <<grade.course;
       cout <<"\n  Subject          : " << grade.subject;
       cout <<"\n  Prelim Grade     : " <<grade.prelim;
       cout <<"\n  Midterm Grade    : " <<grade.midterm;
       cout <<"\n  Endterm Grade    : " <<grade.endterm;
       cout <<"\n";
       grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
       cout <<"\n Student Final Grade : " <<round(grade.final_grade);
  }
          cout <<"\n\n";
         system("pause");
break ;
case '3' :
another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
          cout <<"=== EDIT STUDENT GRADE RECORD ===";
        cout <<"\n\n";
          cout <<"Enter Student ID Number : ";
                cin >> student_id;
    rewind ( fp ) ;
cout <<"\n";
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp ( grade.stud_id_no, student_id) == 0 )
{
cout <<"Enter Student ID Number : ";
                            fflush (stdin) ;
                            gets(grade.stud_id_no);
cout <<"Enter Student Name : ";
fflush ( stdin ) ;
gets(grade.name);
        cout <<"Enter Course: ";
fflush ( stdin ) ;
gets(grade.course);
cout <<"Enter Subject : ";
fflush ( stdin ) ;
gets(grade.subject);
cout <<"Enter Prelim Grade : ";
cin >> grade.prelim;
cout <<"Enter Midtem Grade : ";
cin >> grade.midterm;
cout <<"Enter Endterm Grade: ";
cin >> grade.endterm;
cout <<"\n";
grade.final_grade = (grade.prelim * 0.20) + (grade.midterm * 0.30) + (grade.endterm * 0.50);
cout <<"\n Student Final Grade : " << round(grade.final_grade);
fseek ( fp, - recsize, SEEK_CUR ) ;
fwrite ( &grade, recsize, 1, fp ) ;
break ;
}
}
if (strcmp(grade.stud_id_no,student_id) != 0 )
                 {  
                   cout <<"\n\n";
                   cout <<"No Student Record in the Database.";
                   cout <<"\n";
                   system("pause");
                   break;
                   }
                 cout <<"\n\n";
     cout  <<"\nEdit Another Student Record (Y/N) : ";
fflush ( stdin ) ;
another = toupper(getche());
}
break ;
      case '4' :
   rewind ( fp ) ;
    another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
        cout <<"=== Find Student Records ===";
        cout <<"\n\n";
     cout <<"Enter Student ID Number : ";
                 cin >>student_id;
cout <<"\n";
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no,student_id) == 0 )
{
                    cout <<"\n";
cout <<"\n ID Number      : " <<grade.stud_id_no;
cout <<"\n Name           : " << grade.name;
cout <<"\n Course         :  " <<grade.course;
            cout <<"\n Subject        : " <<grade.subject;
                    cout <<"\n Prelim Grade   :  " <<grade.prelim;
                   cout <<"\n  Midterm Grade  :  " <<grade.midterm;
                   cout <<"\n  Endterm Grade  : " << grade.endterm;
                   cout <<"\n";
       grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
       cout <<"\n Student Final Grade : " << round(grade.final_grade);
       cout <<"\n\n";
       system("pause");
       break;
}
}
      if (strcmp(grade.stud_id_no,student_id) != 0 )
          {
            cout <<"\n\n";
            cout <<"No Student Record found in the Database.";
            cout <<"\n";
            system("pause");
            break;
           }
                    cout  <<"\n\n";
cout  <<"\n Find Another Student Record (Y/N) : " ;
fflush ( stdin ) ;
another = toupper(getche());
}
break ;
case '5' :
another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
                    cout <<"=== REMOVE STUDENT GRADE RECORD ===";
                    cout <<"\n\n";
cout <<"Enter Student ID Number : ";
                    cin >> student_id;
cout <<"\n";
ft = fopen ( "TEMP.DAT", "wb" ) ;
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no, student_id) != 0 )
fwrite ( &grade, recsize, 1, ft ) ;
                 else
                flag=1;
                  }
fclose ( fp ) ;
fclose ( ft ) ;
remove ( "GRADE_DB.DAT" ) ;
rename ( "TEMP.DAT", "GRADE_DB.DAT" ) ;
    fp = fopen ( "GRADE_DB.DAT", "rb+" ) ;
       if(flag==1) {
         cout <<"\n\n";
         cout <<"Record Successfully Deleted From the Database.";
         cout <<"\n";
         system("pause");
         }
else if (flag!=1) {
             cout <<"\n\n";
             cout <<"Record Not Found in the Database.";
             cout <<"\n";
            system("pause");
             }
                    cout <<"\n\n";
cout << "Remove Another Student Record (Y/N) : " ;
fflush (stdin) ;
another = toupper(getche());
}
break ;
case '6' :
fclose ( fp ) ;
cout <<"\n\n";
cout <<"END OF PROGRAM";
cout <<"\n\n";
cout << "Thank You Very Much For Using This Software.";
cout <<"\n\n";
system("PAUSE");
exit(0);
}
}

}

Tuesday, July 24, 2018

Largest and Smallest Number Determiner in C++

In this article I would like to share the work of my student named Arjay Lucernas Vicente we ask permission to him if we can share his work in our website which he agrees to help also other programmers around the world. This program will ask the user to give three numbers and then the program will determine which of the three numbers given is the highest and smallest in terms of values using C++. I would like to thank Arjay for sharing his work to us.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.



Program Listing

number.cpp


/* Arjay Lucernas Vicente */
/* July 23, 2018 */

#include <iostream>
#include <stdlib.h>

using namespace std;
int main()
{

 int a, b, c;
    int smallest, largest; 
    cout << "Please enter 3 numbers: " ;
    
    cout<<"ikauna nga numero ";
    cin>> a;
    cout<<"\n\n";
    cout<<"ikaduwa nga numero ";
    cin>> b;
    cout<<"\n\n";                                                                                 
    cout<<"ikatatlo numero ";
    cin>> c;
    cout<<"\n\n";  
    

    smallest = a;
    largest = a;

    if (b > largest) 
            largest = b;
    if (c > largest)
            largest = c;
    if (b < smallest)
            smallest = b;
    if (c < smallest)
            smallest = c;

    cout << "largest: " << largest;
    cout << "\n\n";
cout << "smallest: "<< smallest << endl;
cout <<"\n\n\n";
const int SIZE = 11;
    for (int i = 0; i<SIZE; i++)
    {
        std::cout << (((1 + (i * 2)) < SIZE) ? std::string((SIZE / 2 - (1 + (i * 2)) / 2), ' ') : std::string((SIZE / 2 - (SIZE * 2 - (1 + (i * 2))) / 2), ' ')) << (((1 + (i * 2)) < SIZE) ? std::string((1 + (i * 2)), '*') : std::string(SIZE * 2 - (1 + (i * 2)), '*')) << endl;
    }
 
    printf("powered by: ARJAY VICENTE");
}