Categories
Java

Decimal To Roman Numeral in Java

Machine Problem in Java

Write a program to ask the user to give a number and then the program will convert the given number into Roman numeral equivalent.

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 [email protected], [email protected], and [email protected]

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 to ask the user to give a number and then the 
program will convert the given number into Roman numeral 
equivalent.

 @author Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com / www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines
 January 14, 2021 Thursday 8:58 PM
*/

import java.util.*;


public class Decimal_Roman_Numeral {

	private static String Convert_To_Roman_Numeral(int num) {
		String[] romanCharacters = { "M", "CM", "D", "C", "XC", "L", "X", "IX", "V", "I" };
		int[] romanValues = { 1000, 900, 500, 100, 90, 50, 10, 9, 5, 1 };
		String result = "";
		 
		for (int i = 0; i < romanValues.length; i++) {
		int numberInPlace = num / romanValues[i];
		if (numberInPlace == 0) continue;
		result += numberInPlace == 4 && i > 0? romanCharacters[i] + romanCharacters[i - 1]:
		new String(new char[numberInPlace]).replace("\0",romanCharacters[i]);
		num = num % romanValues[i];
		}
		return result;
		}
		 
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		 Scanner sc=new Scanner(System.in);
	        int num=0;
	        
	        System.out.println();  
		    System.out.println("\tDecimal To Roman Numeral in Java");
		    System.out.println();
	     
	        System.out.print("\tGive a Number : ");
	        num=sc.nextInt();
	     
	        System.out.println();
	        System.out.println("\tThe Decimal Value   : " + num);
	        System.out.println("\tRoman Numeral Value : "
	        		+ Convert_To_Roman_Numeral(num));
	        System.out.println();
	        System.out.println("\tEnd of Program");
	        System.out.println("\n");
	        sc.close();
	}

} // End of Code

Categories
Java

US Dollar to Philippine Peso in Java

 Machine Problem in Java

  Write a program that will ask for the user to input a certain amount in US Dollar and it will give you its equivalent amount into Philippine Peso.

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 [email protected], [email protected], and [email protected]

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;
import java.text.DecimalFormat;

/**
 * Machine Problem in Java
 * 
 * Write a program that will ask for the user to input a certain amount in US Dollar
 * and it will give you its equivalent amount into Philippine Peso.
 * 
 * @author Jake Rodriguez Pomperada, MAED-IT, MIT
 * [email protected]
 * www.jakerpomperada.com
 * Bacolod City, Negros Occidental
 * January 6, 2020 Wednesday
 */
public class USDollar_Philippine_Peso {
	
	 private static DecimalFormat df2 = new DecimalFormat("#.##");

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		    double ustopeso = 48.04;
	        double us=0.00;
	        
	        Scanner reader = new Scanner(System.in);
	        System.out.println("\n");
		    System.out.print("\t\tUS Dollar to Philippine Peso in Java");
		    System.out.println("\n");
		    
		    System.out.print("\tGive amount in US Dollar : ");
	        us = reader.nextDouble();
	        double amountinpeso = us*ustopeso;
	        
	        System.out.print("\n");
	        System.out.println("\tThe value in Philippine Peso is PHP " +df2.format(amountinpeso));
	        System.out.print("\n");
			System.out.println("\tEnd of Program");
	        System.out.println("\n\n");

        reader.close();
	}

}
Categories
Java

Cube a Number in Java

Machine Problem in Java

Write a program to ask the user to give a number and then the program will compute the cube value of the given number by the user.

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 [email protected], [email protected], and [email protected] 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.comIf 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 to ask the user to give a number and then the 
program will compute the cube value of the given number by
the user.

 @author Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com / www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines
 January 2, 2021 Friday  5:48 PM
*/

import java.util.*;

public class Cube_Number {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	 Scanner sc=new Scanner(System.in);
     int num=0;
     
     System.out.println();  
	    System.out.println("\tCube a Number in Java");
	    System.out.println();
  
     System.out.print("\tGive a Number : ");
     num=sc.nextInt();
  
     System.out.println();
	    System.out.println("\tSquare of "+ num + " is "+ Math.pow(num, 3));
     System.out.println();
     System.out.println("\tEnd of Program");
     System.out.println("\n");

	}
}
Categories
Java

Square a Number in Java

Machine Problem in Java

Write a program to ask the user to give a number and then the program will compute the square value of the given number by the user.

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 [email protected], [email protected], and [email protected] 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.comIf 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 to ask the user to give a number and then the 
program will compute the square value of the given number by
the user.

 @author Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com / www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines
 January 2, 2021 Friday  2:44 PM
*/

import java.util.*;

public class Square_Number {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		 Scanner sc=new Scanner(System.in);
	        int num=0;
	        
	        System.out.println();  
		    System.out.println("\tSquare a Number in Java");
		    System.out.println();
	     
	        System.out.print("\tGive a Number : ");
	        num=sc.nextInt();
	     
	        System.out.println();
		    System.out.println("\tSquare of "+ num + " is "+ Math.pow(num, 2));
	        System.out.println();
	        System.out.println("\tEnd of Program");
	        System.out.println("\n");
	}

}
Categories
Java

Methods in Java

Machine Problem

Write a program that will show how to declare and use methods 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 [email protected], [email protected], and [email protected] 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.comIf 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 that will show how to declare and use
methods in Java programming language.

 @author Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com / www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines
 December 23, 2020   Wednesday
*/
public class Methods {

	  // create a method
	  public int Addition(int a, int b) {
	    int sum = a + b;
	    // return value
	    return sum;
	  }
	  
	// method with no parameter
	  public void title() {
		System.out.println();  
	    System.out.println("\tAddition of Two Numbers");
	    System.out.println();
	  }
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
			 
        System.out.println("\n");
        System.out.print("\tMethods in Java");
        System.out.println("\n");
        
        int a = 12;
        int b = 3;

        // create an object of Methods
        Methods objdemo = new Methods();
        
        // calling methods
        
        objdemo.title();
        
        int result = objdemo.Addition(a, b);
        
        System.out.println("\tThe sum of " +a + " and " 
          + b + " is "  + result + ".");
        System.out.println();
        System.out.println("\tEnd of Program");
        System.out.println("\n");
        

	}

}
Categories
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 [email protected], [email protected], and [email protected]

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
 [email protected]
 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();
	        
	        
	}

}
Categories
Java

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 [email protected], [email protected], and [email protected]

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
 [email protected]
 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");
	}

}
Categories
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 [email protected], [email protected], and [email protected]

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
 [email protected]
 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");
    }

	}


Categories
Java

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 [email protected], [email protected], and [email protected]

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
 [email protected]
 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");
    }
    
    
}
Categories
Java

Bigger Between Two Numbers in Java

Write a program that will ask the user to give two numbers and then the program will check and determine which of the two numbers has a bigger numerical value. If the two numbers have an equal numerical value it will display a message they have the same value.

 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 [email protected], [email protected], and [email protected]

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 that will ask the user to give two numbers
and then the program will check and determine which of the
two numbers has a bigger numerical value. If the two numbers
has an equal numerical value it will display a message they 
have the same value.


 @author Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com / www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines
 December 8, 2020   Tuesday
*/

import java.util.Scanner;

public class Bigger_Between_Two_Numbers {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
        
        System.out.println("\n");
        System.out.print("\tBigger Between Two Numbers in Java");
        System.out.println("\n");
        System.out.print("\tGive First Value  : ");
        int first = input.nextInt();
        System.out.print("\tGive Second Value : ");
        int second = input.nextInt();
        
        System.out.println();
        if (first > second) {
        	System.out.print("\tThe number " + first 
        			+ " has the bigger value than " + second + ".");
        } else if (second > first) {
        	System.out.print("\tThe number " + second 
        			+ " has the bigger value than " + first + ".");
        } else {	
        	System.out.print("\tBoth number " + first 
    			+ " and " + second + " has the same numerical value.");
    } 
        
        input.close();
        System.out.println("\n");
        System.out.println("\tEnd of Program");
        System.out.println("\n");


	}

}