Tuesday, December 15, 2020

Odd and Even Numbers Using Flowgorithm (TAGALOG VERSION)

Bubble Sort in Java

One Dimensional Array Declaration in Java

Bubble Sort in Java

  Machine Problem in Java

 Write a program that will a series of numbers and then it will sort it using bubble sort algorithm in Java 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing

import java.util.Scanner;


/**

 * Machine Problem in Java

 * 

 * Write a program that will a series of numbers and then it will sort it using 

 * bubble sort algorithm in Java programming language.

 * 

 @author Jake Rodriguez Pomperada,MAED-IT, MIT

 www.jakerpomperada.com / www.jakerpomperada.blogspot.com

 jakerpomperada@gmail.com

 Bacolod City, Negros Occidental Philippines

 December 15, 2020  Tuesday   10:22

*/


public class Bubble_Sort {


public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner input=new Scanner(System.in);  

 

int elements[]=new int[100];

System.out.println("\n");

     System.out.print("\t\tBubble Sort in Java");

System.out.println("\n");

 


System.out.print("Enter the number of elements you want to store: ");  

  

int n=input.nextInt();  

  

System.out.println();

for(int i=0; i<n; i++)  

{  

System.out.print("Enter the element No. " + (i+1) + " : ");     

     elements[i]=input.nextInt();  

 

}  

 

System.out.println();

    System.out.println("UnSorted Items of Arrays");

    System.out.println();

    

for(int i=0; i<n; i++)  

{  

//reading array elements from the user   

    System.out.print("" + elements[i] + " ");

 

}  


     // Bubble Sort Routine Here

 

        for (int i = 0; i < n-1; i++)

            for (int j = 0; j < n-i-1; j++)

                if (elements[j] > elements[j+1])

                {

                    

                    int temp = elements[j];

                    elements[j] = elements[j+1];

                    elements[j+1] = temp;

                 }

        

        System.out.println("\n");

        System.out.println("Sorted Items of Array");

        System.out.println();

for(int i=0; i<n; i++)  

{  

    System.out.print("" + elements[i] + " ");

 

}  

 

System.out.println("\n");

     System.out.print("\tEnd of Program");

      System.out.println("\n");

input.close();

        

        

}


}


 

One Dimensional Array Declaration in Java

  Machine Problem in Java

 Write a program that will a series of numbers 10, 20, 30, 40, 50, 60, 70. and 80  using a one-dimensional array in Java 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing

package One_Dimensional_Array;


/**

 * Machine Problem in Java

 * 

 * Write a program that will a series of numbers 10, 20, 30, 40, 50, 60, 70, and 80

 * using a one-dimensional array in Java programming language.

 * 

 @author Jake Rodriguez Pomperada,MAED-IT, MIT

 www.jakerpomperada.com / www.jakerpomperada.blogspot.com

 jakerpomperada@gmail.com

 Bacolod City, Negros Occidental Philippines

 December 15, 2020  Tuesday   10:22

*/



public class One_Dimensional_Array {


public static void main(String[] args) {

// TODO Auto-generated method stub

int elements[]=new int[8];//declaration and instantiation  

elements[0]=10;//initialization  

elements[1]=20;  

elements[2]=30;  

elements[3]=40;  

elements[4]=50;

elements[5]=60;  

elements[6]=70;  

elements[7]=80;  

System.out.println("\n");

     System.out.print("\t\tOne Dimensional Array Declaration in Java");

System.out.println("\n");

 

//traversing array  

System.out.print("\t");

for(int a=0; a<elements.length;a++)//length is the property of array  

System.out.print(" " + elements[a] + " ");

 

        System.out.println("\n");

    System.out.print("\tEnd of Program");

        System.out.println("\n");

}


}


  

Sunday, December 13, 2020

Addition of Three Numbers Using Modern C++

Addition of Three Numbers Using Modern C++

 Machine Problem in C++

Write a program that will ask the user to give three numbers and then the program will compute its sum using Modern C++ approach.

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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing

/* addition_of_three_numbers.cpp
   Jake Rodriguez Pomperada,MAED-IT,MIT
   www.jakerpomperada.com
   www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   December 13, 2020
   Bacolod City, Negros Occidental


Machine Problem in C++

Write a program that will ask the user to give three numbers
and then the program will compute its sum using Modern C++
approach.

*/

#include <iostream>


int main()
{
    int a=0, b=0, c=0, sum=0;
    
    std::cout << "\n\n";
    std::cout << "\tAddition of Three Numbers Using Modern C++";
    std::cout << "\n\n";
    std::cout << "\tEnter First Number  : ";
    std::cin >> a;
    std::cout << "\tEnter Second Number : ";
    std::cin >> b;
    std::cout << "\tEnter Third Number  : ";
    std::cin >> c;

    sum = (a+b+c);
    
    std::cout << "\n\n";
    std::cout << "\tThe sum of " <<a << "," << b << ","
              << " and " << c << " is "  << sum << ".";
   
    std::cout << "\n\n";
    std::cout << "\tEnd of Program";
    std::cout << "\n";
}

Sum and Product of Two Numbers Using Modern C++

Sum and Product of Two Numbers Using Modern C++

 Machine Problem in C++

Write a program that will compute the sum and product of two input numbers.

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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing

/* sum_product.cpp
   Jake Rodriguez Pomperada,MAED-IT,MIT
   www.jakerpomperada.com
   www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   December 13, 2020
   Bacolod City, Negros Occidental


Machine Problem in C++

Write a program that will compute the sum and product of two input numbers.

*/


#include <iostream>


int main()
{
    int a=0, b=0;
    
    std::cout << "\n\n";
    std::cout << "\tSum and Product of Two Numbers Using Modern C++";
    std::cout << "\n\n";
    std::cout << "\tEnter First number  : ";
    std::cin >> a;
    std::cout << "\tEnter Second number : ";
    std::cin >> b;
    std::cout << "\n\n";
    std::cout << "\tThe sum is: " << a+b << "\n";
    std::cout << "\tThe product is: " << a*b << "\n";    
    std::cout << "\n\n";
    std::cout << "\tEnd of Program";
    std::cout << "\n";
}

CRUD using PDO in PHP and MySQL

 In this tutorial I will show you how to create CRUD PDO application using PHP and MySQL


What is PDO?

   PDO = PHP Data Objects. This is a PHP extension that defines a consistent and lightweight interface for accessing databases.

    CRUD = Create/Read/Update/Delete. It means, any basic application that has ability to for creating, deleting, updating and reading the records in the database. Every database application like Inventory System, Accounting System, Point of Sale and other Business-related applications uses CRUD as basis of its database records manipulations.


Contents for PHP PDO CRUD


Creating a database having a table

Establishing the database connection

Creating and Reading records

Edit records

Delete a record







Program Listing

connect.php

 <?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "crud_pdo;
";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
catch(PDOException $e)
    {
    echo "Connection failed: " . $e->getMessage();
    }
?>

index.php

<?php 
include("connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CRUD using PDO in PHP and MySQL</title>
</head>

<body>
<h2>CRUD using PDO in PHP and MySQL</h2>
<h4>Add Record in the Database</h4>
<form action="create.php" method="post" enctype="application/x-www-form-urlencoded">
<label>Name</label>
<input type="text" name="name"   size=50  required="required" /><br /><br />
<label>Telephone Number</label>
<input type="text" name="telephone"  size=50  required="required" /><br /><br />
<label>Mobile Number</label>
<input type="text" name="mobile"   size=50  required="required" /><br /><br />

<label>Email Address</label>
<input type="email" name="email"  size=50 required="required" /><br /><br />

<input type="submit" name="submit" required="required" value="submit" />
</form><br><br>
<table border="1" width="900px" >
<tr>
<th>ID No.</th>
<th>Name</th>
<th>Telephone Number</th>
<th>Mobile Number</th>
<th>Email Address</th>
<th>Action</th>
</tr>
<?php 
$get_datas = $conn->prepare("SELECT * FROM crud");
$get_datas->execute();
if($get_datas->rowCount()>0){
$i=1;
while($res=$get_datas->fetch(PDO::FETCH_ASSOC)){
?>
<tr>
<td align="center"><?php echo $i++; ?></td>
<td align="center"><?php echo $res['name']; ?></td>
<td align="center"><?php echo $res['telephone']; ?></td>
<td align="center"><?php echo $res['mobile']; ?></td>
<td align="center"><?php echo $res['email']; ?></td>
<td><a href="edit.php?id=<?php echo $res['id'];?>">Edit</a><br /><a href="delete.php?id=<?php echo $res['id'];?>">Delete</a></td>
</tr>
<?php } }else{
echo "<tr><td colspan='5'>Records not found</td></tr>";
} ?>
</table>
<script type="text/javascript">
<?php if($_GET['message']){ ?>
alert('<?php echo $_GET['message'];?>');
<?php } ?>
</script>
</body>
</html>

edit.php

<?php 
include("connect.php");
$id = $_GET['id'];
$get_data = $conn->prepare("select * from crud where id = :id");
$get_data->bindParam(":id",$id);
$get_data->execute();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CRUD using PDO in PHP and MySQL</title>
</head>

<body>
<h2>Update Record in the Databae</h2>
<?php if($get_data->rowCount()>0){ 
$result = $get_data->fetch(PDO::FETCH_ASSOC);
?>
<form action="update.php?id=<?php echo $id; ?>" method="post" enctype="application/x-www-form-urlencoded">
<label>Name</label>
<input type="text" name="name" required="required" value="<?php  if(isset($result['name'])){ echo $result['name']; } ?>" /><br /><br />
<label>Telephone Number</label>
<input type="text" name="telephone" required="required" value="<?php  if(isset($result['telephone'])){ echo $result['telephone']; } ?>" /><br /><br />
<label>Mobile Number</label>
<input type="text" name="mobile" required="required" value="<?php  if(isset($result['mobile'])){ echo $result['mobile']; } ?>" /><br /><br />

<label>Email Address</label>
<input type="email" name="email" required="required" value="<?php  if(isset($result['email'])){ echo $result['email']; } ?>" /><br /><br />

<input type="submit" name="submit" required="required" value="submit" />
</form>
<?php } else { 
echo "Invalid Request";
} ?>
<script type="text/javascript">
<?php if($_GET['message']){ ?>
alert('<?php echo $_GET['message'];?>');
<?php } ?>
</script>
</body>
</html>

update.php

<?php
include("connect.php");
$id = $_GET['id'];
$name   = "";
$telephone="";
$email  = "";
$mobile = "";
if (isset($_POST['submit'])) {
    $name         = filter_var($_POST['name'], FILTER_SANITIZE_STRING); // to filter string
    $telephone    = filter_var($_POST['telephone'], FILTER_SANITIZE_EMAIL); // to filter email
    $email        = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); // to filter email
    $mobile       = filter_var($_POST['mobile'], FILTER_SANITIZE_NUMBER_INT); // to filter number
    $check_mobile = $conn->prepare("select * from crud where mobile = '" . $mobile . "' and id not in ('".$id."')"); // to check duplicate
    $check_mobile->execute();
    if ($check_mobile->rowCount() > 0) {
        header("Location: index.php?message=Duplicate entry");
    } else {
        $insert_query = $conn->prepare("update crud set name = :name, telephone=:telephone, email=:email, mobile=:mobile where id = :id"); //to insert data
        try {
            $conn->beginTransaction();
            $insert_query->bindParam(":name", $name);
            $insert_query->bindParam(":telephone", $telephone);
            $insert_query->bindParam(":email", $email);
            $insert_query->bindParam(":mobile", $mobile);
$insert_query->bindParam(":id", $id);
            $count = $insert_query->execute();
            if ($count> 0) {
                header("Location: edit.php?id=$id&message=Record has been updated successfully"); //success data insertion
                header("location:index.php");
            } else {
                header("Location: index.php?id=$id&message=Failed to update"); //failure data insertion
            }
            $conn->commit();
        }
        catch (PDOExecption $e) {
            $dbh->rollback();
            print "Error!: " . $conn->getMessage() . "</br>"; //exception
        }
    }
}
?>

create.php



<?php

// create.php
// insert record in the table

include("connect.php");
$name   = "";
$telephone = "";
$mobile = "";
$email  = "";

if (isset($_POST['submit'])) {
    $name         = filter_var($_POST['name'], FILTER_SANITIZE_STRING); // to filter string
    $telephone    = filter_var($_POST['telephone'], FILTER_SANITIZE_EMAIL); // to filter email
    $mobile       = filter_var($_POST['mobile'], FILTER_SANITIZE_NUMBER_INT); // to filter number
    $email        = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); // to filter email
    $check_mobile = $conn->prepare("SELECT * FROM crud WHERE mobile = '" . $mobile . "'"); // to check duplicate records
    $check_mobile->execute();
    if ($check_mobile->rowCount() > 0) {
        header("Location: index.php?message=Duplicate entry");
    } else {
        $insert_query = $conn->prepare("INSERT INTO crud (name,telephone,mobile,email) VALUES (:name,:telephone,:mobile,:email)"); //to insert data in the table
        try {
            $conn->beginTransaction();
            $insert_query->bindParam(":name", $name);
            $insert_query->bindParam(":telephone", $telephone);
            $insert_query->bindParam(":mobile", $mobile);
            $insert_query->bindParam(":email", $email);
            $insert_query->execute();
            if ($conn->lastInsertId() > 0) {
                header("Location: index.php?message=Record has been inserted successfully"); //success data insertion
            } else {
                header("Location: index.php?message=Failed to insert"); //failure data insertion
            }
            $conn->commit();
        }
        catch (PDOExecption $e) {
            $dbh->rollback();
            print "Error!: " . $conn->getMessage() . "</br>"; //exception
        }
    }
}
?>

crud_pdo.sql

/*
SQLyog Ultimate v12.09 (64 bit)
MySQL - 10.4.14-MariaDB 
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;

create table `crud` (
`id` int (11),
`name` varchar (600),
`telephone` varchar (300),
`mobile` varchar (300),
`email` varchar (300)
); 
insert into `crud` (`id`, `name`, `telephone`, `mobile`, `email`) values('3','Jacob Samuel Pomperada','4335091','09173084334','jacobsamuel@yahoo.com');
insert into `crud` (`id`, `name`, `telephone`, `mobile`, `email`) values('4','Jake Pomperada','4335081','09173084360','jakerpomperada@gmail.com');





CRUD PDO Using PHP and MySQL

Saturday, December 12, 2020

Hello World in Modern C++

Hello World in Modern C++

 In this tutorial I will show you how to write a hello world using modern C++ code.

 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing

#include <iostream>


int main()

{

std::cout << "\tHello World in Modern C++";

}



Prelim Grade Solver in C++ Tagalog Version

Prelim Grade Solver in Modern C++

 Machine Problem in C++

 Write a C++ program to ask the student subject, grades in   the following criteria and compute the prelim grade of the   said subject

     

   1 Written Quiz ( 5%)


   2 Hands on Quiz (30%)


   3 Programming Project (35%)


   4 Prelim Examination (30%)


   Display the Prelim Grade and Remarks whether the student   passed or failed in the Prelim period.

 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing


// prelim_grade.cpp

// Mr. Jake Rodriguez Pomperada, MAED-IT, MIT

// Dev C++

// www.jakerpomperada.com

// www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines



/* Machine Problem in C++


   Write a C++ program to ask the student subject, grades in 

   the following criteria and compute the prelim grade of the

   said subject

      

   1 Written Quiz ( 5%)


   2 Hands on Quiz (30%)


   3 Programming Project (35%)


   4 Prelim Examination (30%)


   Display the Prelim Grade and Remarks whether the student

   passed or failed in the Prelim period.

 

*/  

   

   


#include <iostream>



int main()

{

std::string subject,remarks;

int written_quiz=0.00;

int hands_on_quiz = 0.00;

int programming_project = 0.00;

int prelim_examination = 0.00;

int compute_prelim_grade = 0.00;

std::cout << "\n\n";

std::cout << "\tPrelim Grade Solver in Modern C++";

std::cout << "\n\n";

std::cout << "\tGive Subject Name : ";

std::getline(std::cin,subject);

std::cin.ignore();

std::cout << "\tGive Written Quiz Grade  : ";

std::cin >> written_quiz;

std::cout << "\tGive Hands On Quiz Grade : ";

std::cin >> hands_on_quiz ;

std::cout << "\tGive Programming Project Grade  : ";

std::cin >> programming_project ;

std::cout << "\tGive Prelim Examination Grade : ";

std::cin >> prelim_examination;

compute_prelim_grade = (written_quiz * 0.05) +

                  (hands_on_quiz * 0.3)  +

                  (programming_project * 0.35) +

  (prelim_examination * 0.30);   

if (compute_prelim_grade >= 75) {

remarks = "PASSED";

} else {

remarks = "FAILED";

}   

std::cout << "\n\n";

std::cout << "\t===== DISPLAY RESULTS ======"; 

std::cout << "\n\n";

std::cout << "\tSubject      : " << subject ;

std::cout << "\n";

std::cout << "\tPrelim Grade : " << compute_prelim_grade ;

std::cout << "\n";

std::cout << "\tRemarks      : "  << remarks;

std::cout << "\n\n";

std::cout << "\tEnd of Program";

std::cout << "\n\n";

}


 

Friday, December 11, 2020

Factorial a Number Using For Loop in Java

Factorial a Number Using For Loop in Java

 Machine Problem in Java

 Write a program that will ask the user to give a number and then the program   will compute the factorial value of the given number using for loop statement  in Java 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing


import java.util.Scanner;


/**

 * Machine Problem in Java

 * 

 * Write a program that will ask the user to give a number and then the program

 * will compute the factorial value of the given number using for loop statement

 * in Java programming language


 @author Jake Rodriguez Pomperada,MAED-IT, MIT

 www.jakerpomperada.com / www.jakerpomperada.blogspot.com

 jakerpomperada@gmail.com

 Bacolod City, Negros Occidental Philippines

 December 7, 2020   Monday  12:16 PM

*/




public class Factorial_Using_For_Loop {


public static void main(String[] args) {

// TODO Auto-generated method stub

        long fact =  1;

        

    Scanner input = new Scanner(System.in);


  System.out.println("\n");

     System.out.print("\t\tFactorial a Number Using For Loop in Java");

System.out.println("\n");

        System.out.print("\tGive a Number :  ");

        

        int number = input.nextInt();

     

        System.out.println("\n");

        for(int i = 1; i <= number; i++)

        {

            fact = fact * i;

        }

        System.out.println("\tFactorial of "+number+" is  "+fact);

        

        System.out.println("\n");

    System.out.print("\tEnd of Program");

        System.out.println("\n");

    }


}



Addition of Two Numbers in Java With Error Handling

Addition of Two Numbers in Java with Error Handling

 Machine Problem in Java

  Write a program using Java to ask the user to give two numbers and then it will compute the sum of the two numbers. If the user will give a character or a letter it will display an error message at asking again the user to give a number in order to compute the sum of the two numbers.

 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 at 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 I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing



/**

 * Machine Problem in Java

 * 

 * Write a program using Java to ask the user to give two numbers and then it will

 * compute the sum of the two numbers. If the user will give a character or a letter

 * it will display an error message at ask again the user to give a number in order

 * to compute the sum of the two numbers.


 @author Jake Rodriguez Pomperada,MAED-IT, MIT

 www.jakerpomperada.com / www.jakerpomperada.blogspot.com

 jakerpomperada@gmail.com

 Bacolod City, Negros Occidental Philippines

 December 11, 2020  Friday  9:12 AM

*/



import java.util.Scanner;


public class Accept_Only_Numbers {


    

    public static void main(String[] args) {

        boolean flag;

        String n1,n2;

        int sum=0;

        do

        {

       

         System.out.println("\n");

       System.out.print("\tAddition of Two Numbers in Java with Error Handling");

       System.out.println("\n"); 

        System.out.print("\tGive First Value : ");

 

        Scanner sc = new Scanner(System.in);

 

        n1 = sc.next();

        System.out.print("\tGive Second Value : ");

        n2 = sc.next();

   

        try

        {

           

            sum = Integer.parseInt(n1) + Integer.parseInt(n2);

            

            flag=false;

        }

        catch(NumberFormatException e)

        {

        System.out.println("\n"); 

        System.out.println("\tGive Integer Value Only.");

            flag=true;

        }

      

        

        }while(flag);

        System.out.println("\n"); 

        System.out.println("\tThe sum of "+ n1 + " and " + n2 + " is " + sum);

        System.out.println("\n");

    System.out.print("\tEnd of Program");

        System.out.println("\n");

    }

    

    

}