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
Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
Sladkaya [172]

Answer:

Yes

Explanation:

Because you send it to the java file and the java file is only one single (1)

3 0
3 years ago
An algorithm that could execute for an unknown amount of time because it depends on random numbers to exit a function may:______
Anna007 [38]

Answer:

c. suffer from indefinite postponement.

Explanation:

Algorithm is a set of rules that are followed in calculations or other problem solving operation by a computer. An algorithm may execute for unknown amount of time and it may suffer indefinite postponement. Algorithm depends on random numbers and it can execute continuously.

8 0
3 years ago
Which object waits for and responds toan event from a GUI component?
irakobra [83]

Answer:

The answer is action eventlistener

Explanation:

It is an event handler and it is easy to implement.In java we call them even listeners it is function or a sub routine or a procedure that waits for an event to occur and respond to an event from a GUI component.

8 0
3 years ago
____ technology is the same as that used in digital watches, or the time display on a microwave oven
erma4kov [3.2K]
Digital technology is the same as the used in digital watches, or the time display on a microwave oven. Digital is about using the exact numbers to tell the time. By being digital transmission of data became easy. Sound, images and document are relayed faster and stored conveniently through this system.
4 0
3 years ago
What are the 6 external parts of a computer system
denis23 [38]
1. Monitor
2.C.P.U
3.Mouse
4. Keyboard
5. Printer
6. Speaker
4 0
3 years ago
Other questions:
  • What is something you can do to stay connected to the relationships in your life while we spend this time at home?
    13·1 answer
  • How many packets does your computer send/receive in a single mouse click when you visit a website?
    6·1 answer
  • Scientific models can be used for a variety of different purposes. Which of the following statements about scientific models is
    7·2 answers
  • When might be the best time to start saving for retirement?
    11·2 answers
  • Describe how both IPv4 and IPv6 access and utilize TCP as an upper-layer transfer protocol.
    6·1 answer
  • Write a program that reads in 10 numbers and displays the number of distinct numbers and the distinct numbers in their input ord
    14·1 answer
  • Describe a way that you can envision using the power of the computer through
    13·1 answer
  • Please list 15 safety rules that you think should be practiced in the Computer Technology classroom/lab.
    12·1 answer
  • assume there are K sorted lists, each of n/k elements. We want to merge them into a single sorted list of n elements. Give an op
    7·1 answer
  • What happened to the ten commandments tablets.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!