
Write a complete Java program that prompt the user to enter TEN (10) integers and keep these integers in an array named num[]. Next display in reverse order all the integers that are greater than 15, and calculate and display the total of all integers that are smaller than 15. Use for loops for all repetitive processes and the JOptionPane method for input.

Java Array Example
import javax.swing.*;
class ArrayExample7{
public static void main(String[] args){
int num[]=new int[10];
int sum=0;
for(int i=0;i<num.length;i++){
String number=JOptionPane.showInputDialog(null,"Enter number");
num[i]=Integer.parseInt(number);
if(num[i]<15){
sum+=num[i];
}
}
String st="";
for(int i=0;i<num.length;i++){
if(num[i]>15){
st+=num[i]+" ";
}
}
String arr[]=st.split(" ");
System.out.println("Numbers that are greater than 15 in reversing order:");
for(int i=arr.length-1;i>=0;i--){
System.out.println(arr[i]);
}
System.out.println("Sum of numbers less than 15: "+sum);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.