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
"The effectiveness of memory retrieval is directly related to the similarity of cues present when the memory was encoded to the
alexdok [17]

Answer:

D

Explanation:

Cause You Have To Decode It To Get To The Memory In The First Place

3 0
3 years ago
(In C prog.) What is the difference between scanf, getche and getchar?
lara [203]
<span>getchar() only reads a single character input from any input stream.
getche() </span><span>reads a single character from the keyboard and displays immediately on output screen without waiting for enter key
scanf() reads the whole input line according to the data type you specified.</span>

7 0
3 years ago
Date criteria are automatically enclosed in ____ when entered in a query design.
inysia [295]
Enclosed in number signs ######
4 0
3 years ago
Why are open standards important in the data communications industry?
IrinaK [193]

They enable interoperability between software and hardware from different vendors.

5 0
3 years ago
Write a Python class that inputs a polynomial in standard algebraic notation and outputs the first derivative of that polynomial
Ivahew [28]

Answer:Python code: This will work for equations that have "+" symbol .If you want to change the code to work for "-" also then change the code accordingly. import re def readEquation(eq): terms = eq.s

Explanation:

3 0
3 years ago
Other questions:
  • How do you take a screenshot on an iPhone?
    8·2 answers
  • Cyberterrorism is the use of terrorism to attack (Points : 1) public libraries. computer based networks. government spy networks
    15·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • Assume that a signal is encoded using 12 bits. Assume that many of the encodings turn out to be either 000000000000, 00000000000
    9·1 answer
  • Please help Ill give you brainliest if I get 2 answers. Which is used to input information on a laptop?
    6·1 answer
  • You are almost finished updating a Website. As part of the update, you have converted all pages from HTML 4.0 to HTML5. The proj
    7·1 answer
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
  • ¿Quién recibe la orden de ejecución de un programa enviada por el usuario?
    9·1 answer
  • R6. Suppose N people want to communicate with each of N - 1 other peo- ple using symmetric key encryption. All communication bet
    13·1 answer
  • In a database, what term is used to describe a group of fields that are all associated with and accessed using single primary ke
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!