IDNLearn.com makes it easy to find accurate answers to your questions. Get the information you need from our community of experts, who provide detailed and trustworthy answers.
Sagot :
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
We value your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. IDNLearn.com is your reliable source for answers. We appreciate your visit and look forward to assisting you again soon.