Saturday, May 15, 2021

Factorial a Number in Java with Error Handling Message

 A simple factorial a number in Java with Error Handling Message.

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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com




Program Listing

/* Factorial.java
 * Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
 * www.jakerpomperada.com www.jakerpomperada.blogspot.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental Philippines
 */
import java.util.Scanner;

public class Factorial {
    public static int factorial (int n){
        int result = 1;
        if (n==0)
            return 1;
        else
            for (int i=1; i<=n; i++) {
                result*=i;
            }
            return result;
    }
    
   
    public static void main(String[] args){
      
        Scanner input = new Scanner(System.in);

        boolean valid;
        
        
        System.out.println();
        do {
        System.out.println();
        System.out.print("\tFactorial Program in Java with Error Handling\n\n");
        System.out.print("\tGive a Number : ");
           int number = input.nextInt();
            valid = (number >= 0   && number <= 16);
            System.out.println();
                
            
            if (!valid) {
            System.out.println("\tNegative Values are Invalid Inputs. Try Again.");
              } 
                   
            else {
              System.out.println("\tThe factorial of " + number +
                  " is " + factorial(number) + ".");
                 
              break;
              }
                
       
        }while (!valid);
        System.out.println();
       System.out.println("\tEnd of Program");
       input.close();
       
      }
}

Factorial Program in Java with Error Handling

 A simple factorial program with error handling 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com





Program Listing

/* Factorial.java
 * Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
 * www.jakerpomperada.com www.jakerpomperada.blogspot.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental Philippines
 */
import java.util.Scanner;

public class Factorial {
    public static int factorial (int n){
        int result = 1;
        if (n==0)
            return 1;
        else
            for (int i=1; i<=n; i++) {
                result*=i;
            }
            return result;
    }
    
   
    public static void main(String[] args){
      
        Scanner input = new Scanner(System.in);

        boolean valid;
        
        
        System.out.println();
        do {
        System.out.println();
        System.out.print("\tFactorial Program in Java with Error Handling\n\n");
        System.out.print("\tGive a Number : ");
           int number = input.nextInt();
            valid = (number >= 0   && number <= 16);
            System.out.println();
                
            
            if (!valid) {
            System.out.println("\tNegative Values are Invalid Inputs. Try Again.");
              } 
                   
            else {
              System.out.println("\tThe factorial of " + number +
                  " is " + factorial(number) + ".");
                 
              break;
              }
                
       
        }while (!valid);
        System.out.println();
       System.out.println("\tEnd of Program");
       input.close();
       
      }
}

Friday, May 14, 2021

Quiz in Java With Error Handling

Quiz in Java With Error Handling

 Machine Problem

Create a simple quiz program using 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com





Program Listing

/* Quiz.java

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

 * www.jakerpomperada.com www.jakerpomperada.blogspot.com

 * jakerpomperada@gmail.com

 * Bacolod City, Negros Occidental Philippiens

 */


import java.util.Scanner;


public class Quiz {


/**

* @param args

*/

    static Scanner input = new Scanner(System.in);

    public static void main(String[] args)

    {

           int score = 0;

           final double NumberofQuestions = 5;

                     

           String[][] QandA = {

                               {"Who is the first president of the Philippines?","\n1. Emilio Aguinaldo  \t   2. Joseph Estrada  \n3. Manuel Quezon \t   4: GMA.","1","1. Emilio Aguinaldo"},

                               {"Hitler party which came into power in 1933 is known as?","\n1. Labour Party  \t   2. Nazi Party  \n3. Ku-Klux-Klan  \t   4. Democratic Party","2", "2. Nazi Party"},

                               {"For which of the following disciplines is Nobel Prize awarded?","\n1. Physics and Chemistry  \t         2. Physiology or Medicine  \n3. Literature, Peace, and Economics  \t 4. All of the above","4","4. All of the above."},

                               {"What is 3 * (2-1)?","\n1.1 \t 2.2  \t 3.3 \t 4.4 ","3","3.3"},

                               {"What is 1+1?","\n1.1 \t 2.2 \t 3.3 \t 4.4 ","2","2.2"} };


          String[] Answers = new String[(int) NumberofQuestions];


                    int x=0;

          do

         {

              System.out.println();

          System.out.print(QandA[x][0] + "   "+QandA[x][1] +"\n");

                  System.out.print("Enter [1-4]: ");

              Answers[x] = String.valueOf(input.nextInt());


              Answers[x].toLowerCase();


              if(QandA[x][2].equals(Answers[x]))

              {

              System.out.print("Correct!");

                   score++;

                                     

              }

              else

              {

                  System.out.print("Incorrect. The correct answer is:  "+ QandA[x][3]  );

              }


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

              x++;

         }while(x<NumberofQuestions);                        

             

         System.out.println();

         System.out.print("Congratulations, you got " + score + " answers right!"); 

         System.out.println("\nThat is a score of " + ((score/NumberofQuestions)*100)+"% percent."); 


             System.exit(0);

             input.close();


    }


} // End of Code




Number To Words in Java With Error Handling

Number To Words in Java With Error Handling

 Machine Problem

Create a program that converts numbers to words using 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com









Program Listing

/* Number_Words.java

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

 * www.jakerpomperada.com www.jakerpomperada.blogspot.com

 * jakerpomperada@gmail.com

 * Bacolod City, Negros Occidental Philippines

 */


import java.util.Scanner;


 public class Number_Words {

 

   public static void main(String[] args) {

int number = 0;

Scanner input = new Scanner(System.in);


    boolean valid;

    

    do {

    System.out.println();

    System.out.print("\tNumber To Words in Java\n\n");

    System.out.print("Enter Number: ");

 

   number = input.nextInt();

   valid = (number >= 1   && number <= 100000);

       System.out.println();

           

       if (number > 100000) {

    System.out.print("Number is out of range!\n");

   

       } else if (!valid) {

        System.out.println("Negative numbers, zero, and numbers greater than 100,000 are invalid input.");

         } 

       else {

System.out.print(numberToWord(number));

   }

   }while (!valid);

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

  System.out.println("End of Program");

  input.close();

   }

 

   private static String numberToWord(int number) {

        

        String words = "";

        String unitsArray[] = { "zero", "one", "two", "three", "four", "five", "six", 

                      "seven", "eight", "nine", "ten", "eleven", "twelve",

                      "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", 

                      "eighteen", "nineteen" };

String tensArray[] = { "zero", "ten", "twenty", "thirty", "forty", "fifty",

                      "sixty", "seventy", "eighty", "ninety" };

 

if (number == 0) {

    return "zero";

}

if (number < 0) { 

          

           String numberStr = "" + number; 

           

           numberStr = numberStr.substring(1); 

          

           return "minus " + numberToWord(Integer.parseInt(numberStr)); 

        } 

      

if ((number / 1000) > 0) {

    words += numberToWord(number / 1000) + " thousand ";

    number %= 1000;

}

if ((number / 100) > 0) {

     words += numberToWord(number / 100) + " hundred ";

     number %= 100;

}

 

if (number > 0) {

    

     if (number < 20) { 

                    

                    words += unitsArray[number];

             } else { 

               

                words += tensArray[number / 10]; 

                if ((number % 10) > 0) {

    words += "-" + unitsArray[number % 10];

                }  

     }

          }

  return words;

   }

}

Simple Avatar in HTML and CSS

Simple Avatar Image in HTML & CSS

 A simple avatar image in HTML and CSS that I wrote I hope you will find my work useful.

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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com






Program Listing

index.html

<!DOCTYPE html>

<html lang="en">

    <head>

        <meta charset="UTF-8" />

        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        <meta name="viewport" content="width=device-width, initial-scale=1.0" />

        <title>Simple Avatar Image in HTML & CSS</title>

        <style>

            *,

            html {

                box-sizing: border-box;

                padding: 0;

                margin: 0;

            }


            body {

                display: flex;

                align-items: center;

                justify-content: center;

                min-height: 100vh;

                background: #13141c;

            }


            main {

                display: block;

                padding: 30px;

                border-radius: 10px;

                background: #212330;

            }


            .container {

                text-align: center;

                color: #eee;

                font-family: sans-serif;

                height: auto;

            }


            .wrapper {

                background: #8a8a8a;

                padding: 2px;

                border-radius: 50%;

                width: 300px;

                margin: 20px auto 0;

            }


            img {

                display: block;

                width: 100%;

                border-radius: 50%;

            }

        </style>

    </head>

    <body>

        <main>

            <div class="container">

                <h1>Simple Avatar Image in HTML & CSS</h1>

                <h2>&#187; Jake R. Pomperada, MAED-IT, MIT &#171;</h2>


                <div class="wrapper">

                    <img src="jacob.jpg" class="img-avatar" alt="" />

                </div>

            </div>

        </main>

    </body>

</html>


Thursday, May 13, 2021

Addition of Two Numbers in Julia

Addition of Two Numbers in Julia

Addition of Two Numbers in Julia

 In this tutorial, I will share with you how to write a program that will ask the user to give two numbers, and then the program will compute the sum of the two given numbers using Julia 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com






Program Listing

#= addition.jl
   Jake R. Pomperada, MAED-IT, MIT
   www.jakerpomperada.com   www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   Bacolod City, Negros Occidental
=#
println()
print("\tAddition of Two Numbers in Julia")
println("\n")
print("\tEnter First Value  : ")
a = parse(Int, readline(stdin))
print("\tEnter Second Value : ")
b = parse(Int, readline(stdin))
println()
println("\tThe sum of ",a, " and ", b, " is ", a+b,".")
println()
print("\tEnd of Program")
println("\n")


Wednesday, May 12, 2021

Add, Find, and Count Words in Microsoft Visual Basic NET

Add, Find, and Count Words in Microsoft Visual Basic NET

 A simple program that I wrote in Microsoft Visual Basic NET to count, add, and find words in the text box I hope you will find my work useful.

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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com






Program Listing

' Created By Mr. Jake Rodriguez Pomperada, MAED-IT, MIT

' www.jakerpomperada.com and www.jakerpomperada.blogspot.com

' jakerpomperada@gmail.com

' Bacolod City, Negros Occidental Philippines


Public Class Form1


    Function wordCount(ByVal str As String)

        Dim NumberOfWord As Integer

        NumberOfWord = UBound(Split(Trim(Replace(str, Space(2), Space(1))))) + 1

        Return NumberOfWord

    End Function


    Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged

        If RichTextBox1.Text.ToLower = "" Then

            TextBox1.Text = "0"

        Else

            TextBox1.Text = wordCount(RichTextBox1.Text.ToLower)

        End If


    End Sub


    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


        Dim str_input As String


        str_input = (TextBox2.Text.ToLower)


        RichTextBox1.AppendText(str_input + " ")

    End Sub


    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Dim text1 As String


        text1 = (RichTextBox1.Text)

        Dim mysplit As Array

        mysplit = Split(text1, TextBox3.Text)

        Dim count As Integer


        count = mysplit.Length - 1


        Label4.Text = "No. of Matches : " & count

        Label5.Text = "Find Word : " & TextBox3.Text.ToUpper

    End Sub


    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        TextBox2.Text = ""

        TextBox3.Text = ""

        RichTextBox1.Text = ""

        Label4.Text = ""

        Label5.Text = ""

    End Sub


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

        MsgBox("Created By Mr. Jake Rodriguez Pomperada, MAED-IT, MIT " & vbCrLf _

               & "www.jakerpomperada.com and www.jakerpomperada.com" & vbCrLf _

               & "jakerpomperada@gmail.com", MsgBoxStyle.Information, "About this Program")

    End Sub

  

End Class


DOWNLOAD THE COMPLETE SOURCE CODE HERE


Odd and Even Numbers in Julia