Machine Problem
Create a Java program that will identify if the inputted numbers are the same or not.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
Thank you very much for your support.
Program Listing
/* Same_values.java
*
* Jake Rodriguez Pomperada, MAED-IT, MIT
* www.jakerpomperada.com and www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines
*
*/
import java.util.Scanner;
public class Same_Values {
public static boolean isAllEqual(int[] a){
for(int i=1; i<a.length; i++){
if(a[0] != a[i]){
return false;
}
}
return true;
}
public static void main(String[] args) {
int array[] = new int[5];
int a=0,b=0,c=0,d=0,e=0;
Scanner input_val= new Scanner(System.in);
System.out.println("\n");
System.out.println("\tChecking For Same Numerical Values in Java");
System.out.println();
System.out.print("\tInput first number : ");
a = array[0]=input_val.nextInt();
System.out.print("\tInput second number : ");
b = array[1]=input_val.nextInt();
System.out.print("\tInput third number : ");
c = array[2]=input_val.nextInt();
System.out.print("\tInput fourth number : ");
d = array[3]=input_val.nextInt();
System.out.print("\tInput fifth number : ");
e = array[4]=input_val.nextInt();
System.out.println("\t"+ isAllEqual(new int[] {a,b,c,d,e}));
input_val.close();
}
}