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]
2 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]2 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
Explain why it is important that the device registration is the last thing that is done in the initialization routine of a devic
melisa1 [442]

The reason why device registration is the last thing done is that if any errors happens at the time you register device, you have to undo the registration activities and as such, it is often done last.

<h3>What is role of a device driver?</h3>

The device driver is known to be the device that gives the other part  of the operating system the needed software interface or the device class.

The reason why un-registering a device must happen first in the exit routine of a device driver is because if there is an issue, one has to settle it first before registration as one does not want error.

Conclusively, If any kind of errors is seen when a person wants to register the device, the person must undo any kind of registration that has been performed before that error occurs.

Learn more about device registration from

brainly.com/question/16010611

6 0
2 years ago
To what device, inside the computer, do all other devices connect
11111nata11111 [884]
I believe the answer you're looking for is motherboard
4 0
3 years ago
Read 2 more answers
An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
almond37 [142]

Answer:

B. 1730 PST

Explanation:

First it is important to know that the flight lasted for 2 hours and 15 minutes, hence the first thing to do in this case is to add the duration of flight to the time of departure.

Time of departure = 1615 MST

Flight duration = 2:15

Hence we get 18:30 MST

Then we convert MST to PST by subtracting 1

1830 -1.00 = 1730 PST

5 0
2 years ago
William found out that someone used his report on American culture without his permission. What is William a victim of?
Mnenie [13.5K]

He is a victim of plagiarism.

Plagiarism is when someone steals someone else's work, to help benefit themselves. Taking credit for the other person work.

Hope this helps!

3 0
3 years ago
Read 2 more answers
Which rotation speed is not a typical spindle rotation speed for magnetic hard drives?3100; 5400; 7200; 10000
Hitman42 [59]

Answer:

5,400 because it turns at the right speed, but if it is too fast or too slow, it will not perform at it's fullest potential. Such as speed and storage.

3 0
3 years ago
Other questions:
  • To change to the completed application’s directory, we opened a command window and used the ________ command to change to the di
    7·1 answer
  • Which component is the smallest unit in a spreadsheet?
    14·2 answers
  • Which of the following statements is true?
    8·1 answer
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • If str 1 and str2 are both Strings, which of the following expressions will correctly
    13·1 answer
  • To remove text from a specific location and keep it to use again, you should select ___
    6·1 answer
  • Stroke weight - ____ of the line around a shape or size of the point
    8·1 answer
  • Office 365 ProPlus can be deployed to your enterprise. When doing so, which tool enables you to choose the language, hardware ar
    5·1 answer
  • Consider the following method, which is intended to count the number of times the letter "A" appears in the string str.
    13·1 answer
  • You're doing desktop support and the company policy is that you can only help with company equipment. A user walks in:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!