Categories
JavaScript

Addition of Two Numbers in JavaScript

In this article, I will show you how to write a JavaScript program to add the sum of two given numbers by user.

I am currently accepting programming work inventory system, enrollment system, accounting system, point of sale, school programming assignments and projects, payroll system, information system, website design and development using WordPress, 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

Program Listing

<doctype html>
<html>
<head>
	<style>
		body {
			font-family: arial;
		}
   </style>		
<script>
function add(){
var a,b,c;
a=Number(document.getElementById("first").value);
b=Number(document.getElementById("second").value);
c= a + b;
document.getElementById("answer").value= c;
}
</script>
</head>
<body>
<h3> Addition of Two Numbers in JavaScript </h3><br>
Give the First number : <input id="first"><br>
Give the Second number: <input id="second"><br><br>
The result <input id="answer"><br><br>
<button onclick="add()">Add</button>
</body>
</html>
Categories
Bash

Positive and Negative Number Checker in Bash

A simple program that I wrote using that will ask the user to give a number and then the program will check if the given number is a positive or negative number using bash scripting language. 

I am currently accepting programming work inventory system, enrollment system, accounting system, point of sale, school programming assignments and projects, payroll system, information system, website design and development using WordPress, 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

Program Listing

# positive_negative.sh
#Bash Script to check whether a number is positive or not
#Jake R. Pomperada,MAED-IT,MIT
# Bacolod City, Negros Occidental
# jakerpomperada@gmail.com

printf  "\n\n"
printf  "\tPositive and Negative Number Checker in Bash"
printf   "\n\n"
read -p "Enter a number: " number
printf "\n"
if [ $number -ge 0 ]
then
  printf "\tThe given number $number is positive."
else
  printf "\tThe given number $number is negative."
fi
printf "\n\n"
printf  "\tEnd of Program"
printf "\n"
Categories
PHP

Calculator in PHP

A calculator program written in PHP programming language.

 I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comMy programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

<!doctype html>
<html>
	<head>
		<title>Calculator in PHP</title>
	</head>
	<body>
		<form method="POST" action="">
			<h2>Calculator in PHP</h2>
<?php
$n1=$n2=$res=0;
if(isset($_POST['operation'])){
	$n1=$_POST['n1'];
	$n2=$_POST['n2'];
	$operation=$_POST['operation'];
	
	if($operation=="Add"){
		$res=$n1+$n2;
	}elseif($operation=="Subtract"){
		$res=$n1-$n2;
	}elseif($operation=="Multiply"){
		$res=$n1*$n2;
	}else{
		$res=$n1/$n2;
	}
}
?>			
			
			<p>Num1: <input type="text" name="n1" value="<?=$n1;?>" size="5"/></p>
			<p>Num2: <input type="text" name="n2" value="<?=$n2;?>" size="5"/></p>
			<p>
				<input type="submit" name="operation" value="Add"/>
				<input type="submit" name="operation" value="Subtract"/>
				<input type="submit" name="operation" value="Multiply"/>
				<input type="submit" name="operation" value="Divide"/>
			</p>
			<p>Result: <input type="text" name="res" value="<?=$res;?>" size="5"/></p>
		</form>
	</body>
</html>
Categories
C++

Asynchronous file reading in C++

A program written by my friend Tom to demonstrate multi treading concept of programming in C++. Thank you Tom for sharing your code to us.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comMy programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <thread>
#include <future>
#include <chrono>

const std::string lorem = R"(
Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo
dolores et ea rebum.
)";

void create_file(std::ostream& os, const std::string& s, int count)
{
   for (int i = 0; i < count; ++i)
     os << s << '\n';
}

std::string read_file(std::istream& is)
{
   std::stringstream ss;
   std::string line;
   int count = 0;

   while(std::getline(is, line))
   {
     ss << line << '\n';
     ++count;
     if (count % 5000 == 0)
     {
       std::cout << "\nThread " << std::this_thread::get_id() << " read
" <<
       count << " lines\n";
       std::this_thread::sleep_for(std::chrono::milliseconds(500));
     }
   }
   return ss.str();
}


int main()
{
   std::cout << "Main thread " << std::this_thread::get_id() << "
started\n\n";
   std::ofstream dest("lorem.txt");
   if (!dest)
   {
     perror("Error creating file. ");
     return EXIT_FAILURE;
   }
   create_file(dest, lorem, 10000);
   dest.close();

   std::ifstream src("lorem.txt");
   if (!src)
   {
     perror("Error opening file. ");
     return EXIT_FAILURE;
   }
   std::future<std::string> content = std::async(std::launch::async,
                                      [&] {return
read_file(std::ref(src));});
   for (int i = 0; i <= 100; ++i)
   {
     if (i % 10 == 0)
     {
       std::cout << "Thread: # " << std::this_thread::get_id()
                 << " i = " << i << '\n';
     }
     // sim long task
     std::this_thread::sleep_for(std::chrono::milliseconds(75));
   }
   std::string str = content.get();
   std::cout << "Length of file: " << str.size() << '\n';
}
Categories
C

Average Grade Solver Using C Language

I wrote this program to ask the user to give a series of grades of the students and then the program will compute the average grade of the student and also display if the student pass or fail using C programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comMy programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

 /* average.c
   Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date     : June 13, 2020  7:39 AM  Saturday
   Location : Bacolod City, Negros Occidental
   Tool     : Dev C++ Version 5.11
   Website  : http://www.jakerpomperada.com
   Email    : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com
*/
 #include <stdio.h>
 
 int main() {
     int numbers[5];
     int a=0,solve=0,sum=0;
     printf("\n\n");
     printf("\tAverage Grade Solver Using C Language");
     printf("\n\n");
     for (a=0; a<=4; a+=1) {
         printf("\tEnter Grade No. %d : ",a+1);
         scanf("%d",&a[numbers]);    
     }
    printf("\n\n");
     for (a=0; a<=4; a+=1) {
         sum = sum + a[numbers];
         solve =( sum / 5);
     }
    printf("\tThe average grades is %d. ",solve);
    printf("\n\n");
      if (solve >=75) {
      	  printf("\n");
          printf("\tYou Passed the subject");
      }
      else {
      	  printf("\n");
          printf("\tYou Failed the subject");
      }
printf("\n\n");
printf("\tEnd of Program");
printf("\n\n");
 }

Categories
C

Highest and Lowest Value Checker Using C Language

Design a program using a one-dimensional array that will ask the user
to give a series of numbers and then the program will check
and determine which of the given number is the highest and
lowest in terms of numerical value and then display the result on
the screen using the C programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comMy programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Sample Program Output

Program Listing

/* highest_lowest.c
   Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date     : June 13, 2020    6:54 AM  Saturday
   Location : Bacolod City, Negros Occidental
   Tool     : Dev C++ Version 5.11
   Website  : http://www.jakerpomperada.com
   Email    : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com
*/
#include <stdio.h>
int main ()
{
    int arr[20], b=0, max=0, min=0;
    printf("\n\n"); 
    printf("\t\tHighest and Lowest Value Checker");
    printf("\n\n");
    printf("\tHow many items to be process? : ");
    scanf("%d",&b);
    printf("\n\n");
    printf("\tEnter items values : ");
    for (int a = 0; a < b; a++){
	     scanf("%d",&arr[a]);
      }
        max = arr[0];
    for (int a = 0; a < b; a++)
    {
        if (max < arr[a])
            max = arr[a];
    }
    min = arr[0];
    for (int a = 0; a < b; a++)
    {
        if (min > arr[a])
            min = arr[a];
    }
    printf("\n\n");
    printf("\t===== DISPLAY RESULT =====");
    printf("\n\n");
    printf("\tThe Largest Value is %d.",max);
    printf("\n\n");
    printf("\tThe Smallest Value is %d.",min);
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n\n");
}
Categories
C

Student Grades Checker in C Language

A simple program that I wrote using C programming language to compute and check the students grades.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Sample Program Output
/*pass_fail.c
   Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date     : June 13, 2020  7:26 AM  Saturday
   Location : Bacolod City, Negros Occidental
   Tool     : Dev C++ Version 5.11
   Website  : http://www.jakerpomperada.com
   Email    : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com

*/
#include <stdio.h>

int grades[6],a=0;
int count_pass=0, count_fail=0;

void display_title(void);
void get_data(void);
void display_pass(void);
void display_fail(void);
void display_result(void);

void display_title(void)
{
     printf("\n\n");
	 printf("\t\tStudent Grades Checker");
     printf("\n\n\n");
}

void get_data(void)
{
  for (a=1; a<=5; a+=1) {
  	      printf("\tEnter Grade No. %d : ",a);
  	      scanf("%d",&a[grades]);
      }
}

void display_pass(void)
{
     printf("\n\n");
     printf("\tList of PASSED Grades ");
     printf("\n\n");
        for (a=1; a<=5; a+=1) {
          if (a[grades] >= 75) {
          	printf("\t %d ",a[grades]);
               count_pass++;
              }
         }
  }

void display_fail(void)
{
      printf("\n\n");
      printf("\tList of FAILED Grades ");
      printf("\n\n");
       for (a=1; a<=5; a+=1) {

           if (a[grades] < 75) {
               printf("\t %d ",a[grades]);
              count_fail++;
              }
       }
}

void display_result(void)
{
printf("\n\n");
printf("\tNumber of Passed Grades => %d ",count_pass);
printf("\n\n");
printf("\tNumber of Failed Grades => %d ",count_fail);
printf("\n\n");
printf("\tEnd of Program");
printf("\n\n");
}
 int main() {
    display_title();
    get_data();
    display_pass();
    display_fail();
    display_result();
    }
 // End of Code
Categories
Perl

Switch Statement in Perl

A simple program that demonstrate how to use switch statement using Perl programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

# switch_example.pl
# Author  : Jake Rodriguez Pomperada,MAED-IT,MIT
# Date    : April 26, 2020  Sunday  2:21 PM
# Email   : jakerpomperada@gmail.com
# Websites : http://www.jakerpomperada.com
#            http://www.jakerpomperada.blogspot.com

use Switch;

print "\n\n";
print "\tSwitch Statement Example ";
print "\n\n";

$var = 10;
@array = (10, 20, 30);
%hash = ('key1' => 10, 'key2' => 20);

switch($var) {
   case 10           { print "\tnumber 100\n" }
   case "a"          { print "\tstring a" }
   case [1..10,42]   { print "\tnumber in list" }
   case (\@array)    { print "\tnumber in list" }
   case (\%hash)     { print "\tentry in hash" }
   else              { print "\tprevious case not true" }
}
Categories
Java

Remove Vowels in Java

I wrote this program to ask the user to give string and then the program to remove the vowels in the given string using Java programming language.
I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comI am also a book author you can purchase my books on computer programming and information technology in the following links below. https://www.unlimitedbooksph.com/


Program Listing

// demo.java
// Written By: Jake Rodriguez Pomperada
// Barangay Alijis, Bacolod City, Negros Occidental Philippines.
// www.jakerpomperada.com
// jakerpomperada@gmail.com
// May 14, 2020  Thursday

package test;

import java.util.Scanner;

public class demo {

   static String Remove_Vowels(String str)
   {
    return  str.replaceAll("[AIEOUaieou]","" );
   }
	
	public static void main(String[] args) {
     
	Scanner input = new Scanner(System.in);
     
     String str_given,display_result;
     
    System.out.print("\n\n");
    System.out.print("\tRemove Vowels in Java");
    System.out.print("\n\n");
    System.out.print("\tGive a String : ");
    str_given = input.nextLine();
    
    System.out.print("\n"); 
    System.out.print("\tString : " + str_given);
    display_result = Remove_Vowels(str_given);
    System.out.print("\n");
    System.out.print("\tResult : " + display_result);
    System.out.println();  
	}

}
Categories
C

Math Operations Using Switch in C

Math operations using the switch in C programming language was written by my close friend and fellow software engineer Sir Ernel. Thank you sir Ernel  for sharing your work with us.


I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

#include<stdio.h>

int main()
{
int num1,num2,choice;
printf("\nEnter the two numbers\n");
scanf("%d %d",&num1,&num2);
printf("\n1 Addition");
printf("\n2 Subtraction");
printf("\n3 Multiplication");
printf("\n4 Division");
printf("\n5 Modulus");
printf("\nEnter the choice:");
scanf("%d",&choice);
switch(choice)
{
case 1:printf("\nThe Addition of two numbers is %d",num1+num2);
break;
case 2:printf("\nThe Subtraction of two numbers is %d",num1-num2);
break;
case 3:printf("\nThe Multiplication of two numbers is %d",num1*num2);
break;
case 4:printf("\nThe Division of two numbers is %d",num1/num2);
break;
case 5:printf("\nThe Modulus of two numbers is %d",num1%num2);
break;
default:printf("\nThis operation is not possible");
}
return 0;
}