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
If you want help using drawing, word processing, and e-mail programs, the best place for you to find it is through the Start men
ZanzabumX [31]

Answer:

True

Explanation:

True

5 0
3 years ago
This process can be applied to help workers choose the best telecommunications technology to do a specific task.
Lisa [10]
B. Internet Telephony would be my best guess. I'm not that good with computers. Hope this Helps :-)
4 0
3 years ago
Read 2 more answers
Which of the following sets of data would be represented best in histogram?
wariber [46]
I think it would be B. The average monthly sales for the big toy company because its giving data over history
7 0
4 years ago
Read 2 more answers
PLEASE HURRY
Katarina [22]

Answer:

1. 321 x 408 print (321 times 408)

Explanation:

It is multiplication, it will create a product. So that is why.

3 0
3 years ago
Read 2 more answers
Which method below will allow you to rearrange the order of your slides to ensure the overall flow of your presentation makes se
omeli [17]
Um... there are no methods on this page, but my guess is... order of importance?   
4 0
3 years ago
Other questions:
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • Pls Help Me!!!!!!!!!!! It won’t work when I connect to ITunes!
    12·1 answer
  • Name 3 examples of operating system software that are not Windows based.
    5·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • Discuss All control statements supported by Go
    13·1 answer
  • Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
    6·1 answer
  • If Tamya makes $1000.00 gross monthly income and her total payroll deductions are $294.00, what is her net income?
    9·1 answer
  • Write a program to find the principle amount​
    10·1 answer
  • What are node in a computer network​
    14·1 answer
  • A video game controller contains the buttons: A, B, X, Y. When the player presses A their character Jumps. When the player press
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!