Westonci.ca connects you with experts who provide insightful answers to your questions. Join us today and start learning! Join our Q&A platform to connect with experts dedicated to providing precise answers to your questions in different areas. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.
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 appreciate your time. Please revisit us for more reliable answers to any questions you may have. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.