Answer:
The program in Java is as follows:
import java.util.*;
public class Main{
public static void getUs erValues(int[ ] myArr, int arr Size, Scanner scnr){
for(int i = 0; i<arrSize;i++){
myArr[i] = scnr.nextInt(); }
outputIntsLessThanorEqualToThreshold (myArr, arrSize, myArr[arrSize-1]);
}
public static void outputIntsLessThanorEqualToThreshold (int[] userValues, int userValsSize, int upperThreshold){
for(int i = 0; i<=userValsSize;i++){
if(userValues[i]<upperThreshold){
System.out.print(userValues[i]+" "); } }
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int n;
n = scnr.nextInt();
int [] myArr = new int[n];
getUserValues(myArr,n,scnr); }
}
Explanation:
See attachment for complete program where comments are used to explain each line