1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dezoksy [38]
3 years ago
10

Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is

the upper threshold. Then output all integers less than or equal to the threshold value. Ex: If the input is 50 60 140 200 75 100, the output is: 50 60 75 For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. Your program should define and use a function: Function outputIntsLessThanOrEqualToThreshold(integer array(
Computers and Technology
1 answer:
Andrew [12]3 years ago
6 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

    int[] arr = new int[5];

   

    System.out.println("Enter values for integer list: ");

    for (int i=0; i<5; i++){

        arr[i] = input.nextInt();

    }

   

    System.out.print("Enter the threshold: ");

    int t = input.nextInt();

   

    outputIntsLessThanOrEqualToThreshold(arr, t);

   

}

public static void outputIntsLessThanOrEqualToThreshold(int[] arr, int threshold){

   

    for (int x: arr){

        if (x<threshold)

            System.out.print(x + " ");

    }

}

}

Explanation:

Create a function called outputIntsLessThanOrEqualToThreshold that takes two parameters, arr and threshold

Check each element in the arr. If they are smaller than the threshold, print the element

Inside the main:

Initialize the array with user inputs and get the threshold value

Call the outputIntsLessThanOrEqualToThreshold function with the entered array numbers and threshold value

You might be interested in
Which type of network topology is the most common and easiest to use?
Airida [17]
<span>A network layout or topology that is the most common, the most simple and easiest to use out of the four network topologies is the Bus topology, one cable is used for installation so it is also the cheapest network type.</span>
5 0
3 years ago
Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
Pie

Yes the ansewer is c bc you can look it up!


6 0
3 years ago
Which service uses a broadband connection?
Sidana [21]

Answer:

d

Explanation:

because all in one question form

5 0
3 years ago
How do you restore deleted notpad++ file?
Natasha2012 [34]
Check your trash can, if that doesnt work then I would say its lost.
3 0
3 years ago
Select the correct answer.
Naddika [18.5K]

Answer:

E

Explanation:

4 0
3 years ago
Other questions:
  • reate a class called Plane, to implement the functionality of the Airline Reservation System. Write an application that uses the
    5·1 answer
  • Why should you not perform any personal grooming task while driving?
    5·2 answers
  • Adam is evaluating the security of a web server before it goes live. He believes that an issue in the code allows an SQL injecti
    11·1 answer
  • How do I write code in Java for "A spinner for a game has four possible options: blue, red, yellow, green. The chance of landing
    10·1 answer
  • who will follow me on tiktok and like all my videos? if you do ill give branlist and give u a shoutout and you can enter my big
    15·1 answer
  • Analyze the problem statement. Select the correct answer. Vision: We want to decrease errors in our billings to clients. Issue:
    5·1 answer
  • What part of a computer is the most important?
    13·2 answers
  • Binary Search:<br><br><br> 2 6 15 42 55 89 111 256
    6·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MY QUESTION WHICH IS DUE TODAY PLZ ANSWER ALL OFIT!!!!
    10·1 answer
  • The factors of power of device
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!