Wednesday, December 25, 2019

Global and Local Variables in C++

Here is a simple program in C++ to show how to declare and use local and global variables.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair,web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/


Program Listing

#include <iostream>

using namespace std;

int Displayg_var();
int Func1();
int Func2();

int g_var=0;

int main()
{

    Displayg_var();
                                          system("Pause");
    g_var=6;
                                          system("Pause");
    Displayg_var();
                                          system("Pause");
    Func1();
                                          system("Pause");
    Displayg_var();
                                          system("Pause");
    Func2();

    system("Pause");
    return 0;
}

int Displayg_var()
{
    cout<<"\n\nThe Value of v_gar now is: "<<g_var<<endl;
}

int Func1()
{
    g_var=3;
}

int Func2()
{
    int g_var;

    g_var=101;
    cout<<"\n\nThe value of g_var(local variable) inside Func2 is: "<<g_var<<endl;
}


Tuesday, December 24, 2019

Kilogram To Ounce Converter in JavaScript

I wrote this program to ask the user to give kilogram value and then it will convert into ounce weight equivalent using JavaScript programming language.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/




Sample Program Output


Program Listing

index.html

<html>
  <head>
   <title>Kilogram To Ounce Converter in JavaScript</title>
  </head>
  <body>
  <style>
      body {
       font-family: arial;
       font-size: 20px;
       font-weight: bold;
      }
   </style>
<script type="text/javascript">
   function forward() {
      with (document.convert) {
unit1.value = unit1.value.toString().replace(/[^\d\.eE-]/g,'');
if (unit1.value/0.0252 != 0) {
    unit2.value = (unit1.value/0.0252).toFixed(2);
}
      }
   }
   function backward() {
      with (document.convert) {
unit2.value = unit2.value.toString().replace(/[^\d\.eE-]/g,'');
if (unit2.value*0.0252 != 0) {
    unit1.value = (unit2.value*0.0252).toFixed(2);
}
      }
   }
</script>

<h4></h4>
<noscript><p><font color="red"><strong>Please enable Javascript
to use the unit converter</strong></font></p></noscript>
<form name="convert" style="font-size:1.3em;border:solid 1px #B7D7AF;border-radius:7px;background-color:#EEEEEE;margin-right:10px;padding-left:10px;padding-right:10px">
<br />
<tr>
<td><strong>Kilogram To Ounce Converter in JavaScript</strong></td></tr>
<table border="0" cellpadding="7" cellspacing="0">

<tr>
<td><input type="number" step="0.1" name="unit1" style="width:200px;font-size:1em" onchange="forward()" value=""></td><td><strong>Kilogram</strong></td></tr>
<tr><td><input type="number" step="0.1" name="unit2" style="width:200px;font-size:1em" onchange="backward()" value=""></td><td><strong>Ounce</strong></td></tr>
<tr><td><input type=button value="Convert" style="font-size:1em;margin-bottom:15px" onclick="forward()"></td></tr></table>
</form>
</body>
</html>



Product of Two Numbers in JavaScript

I wrote this program using JavaScript to ask the user to give two numbers and then the program will compute the product of two numbers and display the results using an alert dialog box in JavaScript.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/



Sample Program Output


Program Listing

index.html

<html>
  <head>
   <title>Product of Two Numbers in JavaScript</title>
  </head>
  <style>
      body {
       font-family: arial;
       font-size: 20px;
       font-weight: bold;
      }
   </style>
  <body>
 
<script>
function product(){
var num1=document.form.text1.value;
var num2=document.form.text2.value;
var sum=Number(num1)*Number(num2);
alert("The product between " + num1 + " and " + num2 + " is " + sum + ".");
}
</script>
<form name="form"><br>
<h4>Product of Two Numbers in JavaScript</h4>
<table>
<tr>
<td>Enter First Number:</td>
<td><input type="text" name="text1"></td>
</tr>
<tr>
<td>Enter Second Number:</td>
<td><input type="text" name="text2"></td>
</tr>
<tr>
<tr></tr><tr></tr>
<td><input type="button" value="Solve For Product" onclick="product();"></td>
</tr>
</table>
</body>
</html>


Monday, December 23, 2019

Highest To Lowest Salary in C++ Language

I wrote this program to sort the name and salary of the employees from highest to lowest using C++ programming language.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com



Sample Program Output


Program Listing

salary.cpp

//  salary.cpp
//   Author : Jake R. Pomperada,MAED-IT
//   December 22, 2019    10:09 AM
//   Monday
//   Bacolod City, Negros Occidental Philippines 
//   www.jakerpomperada.com
//   jakerpomperada@gmail.com

#include <iostream>
#include <iomanip>

using namespace std;

struct employee
{
    double salary ;
    char emp_name[200];
}emp_records[200],t;

int main()
{
    int i=0,j=0,n=0;
    cout <<"\n\n";
    cout <<"\tHighest To Lowest Salary in C++ Language";
    cout <<"\n\n";
    cout <<"\tHow many employees? : ";
    cin >> n;
   
    for(i=0;i<n;i++)
    {
         cin.ignore();
         cout <<"\tGive Employees Name   : ";
         cin.getline(emp_records[i].emp_name,100);
        
       
         cout <<"\tGive Employees Salary : ";
         cin >>emp_records[i].salary;
    }
    
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-1;j++)
        {
            if(emp_records[j].salary<emp_records[j+1].salary)
            {
                t=emp_records[j];
                emp_records[j]=emp_records[j+1];
                emp_records[j+1]=t;
            }
        }
    }
    cout<<"\n\n";
    cout <<"\tEmployees that has the Highest to Lowest Salary\n\n";
    cout <<setw(25)<<" EMPLOYEES NAME" <<setw(15)<<"SALARY\n";
    cout <<setw(20)<<"-------------------------------------------------\n\n";
    
    for(i=0;i<n;i++)
    {
       cout <<fixed;
   cout <<setw(25)<<emp_records[i].emp_name <<setw(12)<<"PHP "<<setprecision(2)
   <<emp_records[i].salary<<"\n""";
    }
    cout <<"\n\n";
    cout <<"\tEnd of Program";
    cout<<"\n\n";
}



Sunday, December 22, 2019

Highest To Lowest Scores in C Language

A simple program that I wrote using C programming language that will ask the user how many basketball players to be a process of our program and then the program will ask the basketball player names and their perspective score in a basketball game. The program will sort the name of the basketball players based on the highest score in a table being generated by our program.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/



Sample Program Output


Program Listing

score.c

/* scores.c
   Author : Jake R. Pomperada,MAED-IT
   December 22, 2019    10:29 PM
   Sunday
   Bacolod City, Negros Occidental Philippines */

#include <stdio.h>
#include <conio.h>

struct student
{
    int  scores;
    char name[100];
}players[100],t;

void main()
{
    int i=0,j=0,n=0;
    printf("\n\n");
    printf("\tHighest To Lowest Scores in C Language");
    printf("\n\n");
    printf("\tEnter the no of Basketball Players: ");
    scanf("%d",&n);
   
    for(i=0;i<n;i++)
    {
         getchar();
printf("\tEnter Basketball Player Name  : ");
         gets(players[i].name);
       
         printf("\tEnter Basketball Player Score : ");
         scanf("%d",&players[i].scores);
    }
    
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-1;j++)
        {
            if(players[j].scores<players[j+1].scores)
            {
                t=players[j];
                players[j]=players[j+1];
                players[j+1]=t;
            }
        }
    }
    printf("\n\n");
    printf("\tBasketBall Players that has the Highest to Lowest Points\n");
    printf("\n\t\tNAME\t\t\t\tSCORES\n");
    printf("-------------------------------------------------------------------------------\n");
    for(i=0;i<n;i++)
    {
        printf("\t\t%s\t\t\t%d\n",players[i].name,players[i].scores);
    }
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n\n");
}

Employee's Payroll System that Display Highest and Lowest Salary in Java

Here is the code that is being shared with us by my good friend and fellow software engineer Sir Jake Macalig-og which I modify and improve that will compute the salary of the employees and sort the salary of the employees from highest to lowest. We wrote this code will some difficulty because there is no existing code on the Internet so we have to write it from scratch.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

If you like my video tutorials kindly click the like button and subscribe for more video tutorials on my channel.


Thank you very much for your help and support.


Sample Program Output


Program Listing

payroll.java

package test;

import java.util.Scanner; 


public class payroll {

public static void main(String[] args) {
Scanner input = new Scanner (System.in);
      int employees = 0;
      int num = 6; 
      int  temp=0;
      String tempName;
      int[] grossPay  = new int[100];
      //arrays
      String[] names = new String [100];
    
      int[] days = new int[100];
      int[] rate = new int[100];
      int[] wages;
      //scanner
       Scanner keyboard = new Scanner(System.in);
        System.out.println( "EMPLOYEES PAYROLL SYSTEM");
        System.out.println();
        System.out.println("It Displays Highest and Lowest Salary of Employees");
        System.out.println();
         for (int i = 1; i == 1;)
       {
      keyboard.nextLine();
       
         System.out.print( "Enter the Name of Employee  : ");
         names[employees] = keyboard.nextLine();

         System.out.print( "Enter the daily rate        : ");
         rate[employees] = keyboard.nextInt();

         System.out.print( "Enter the days worked       : ");
         days[employees] = keyboard.nextInt();

         System.out.print("Do you want to enter again your employees? [1-Yes / 2-No] : ");
          i = input.nextInt();
          employees++;
      }
       for (int i = 0; i < employees; i++)
         {
           grossPay[i] = days[i] * rate[i];
          
         }
   
  // Bubble Sort of Gross Pay of the Employees together with its Name here
         for (int i = 0; i < employees - 1; i++) 
           {
               for (int j = i + 1; j < employees; j++) 
               {
                   if (grossPay[i] < grossPay[j]) 
                   {
                       temp = grossPay[i];
                       grossPay[i] = grossPay[j];
                       grossPay[j] = temp;

                       tempName = names[i];
                       names[i] = names[j];
                       names[j] = tempName;
                   }
               }
           }

      System.out.print("\n\n");
      System.out.print("\tHighest To Lowest Salary of Employees");
      System.out.print("\n\n");
      for (int i = 0; i < employees; i++){
               
          System.out.println(names[i] + ":" + grossPay[i]);
        }
      System.out.println();
      System.out.println("\tEnd of Program");
      System.out.println();
       
}

} // End of Code




Saturday, December 21, 2019

Miles To Kilometers Distance Table in Java

A simple program in Java that will display a table of distance equivalent of miles to kilometers and vice versa.

I am currently accepting programming work, IT projects, school and application development, 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 on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

If you like my video tutorials kindly click the like button and subscribe for more video tutorials on my channel.


Thank you very much for your help and support.



Sample Program Output



Program Listing

distance.java

package test;

public class distance {

public static void main(String[] args) {
final double KILOMETERS_PER_MILE = 1.609;
System.out.print("\n\n");
        System.out.println("\tMiles To Kilometers Distance Table in Java");
System.out.print("\n\n");
        // Display table header
System.out.println(
"Miles      Kilometers   |   Kilometers     Miles     ");

// Create and display tables
for (int m = 1, k = 11; m <= 10 && k <= 20; m++, k += 1) {
System.out.printf(
"%-11d%-10.3f", m, (m * KILOMETERS_PER_MILE));
System.out.print("   |   ");
System.out.printf(
"%-15d%-6.3f\n", k, (k / KILOMETERS_PER_MILE));
}

}

}