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
How many wins does ninja have :/
den301095 [7]

Answer:

he played 13,500 games and has 37 percent win rate

5 0
3 years ago
Why would a programmer want to overload operators rather than use regular member functions to perform similar operations?
Harlamova29_29 [7]
The Programmer wants to overload operators rather than use a regular member of the functions to perform similar operations because of two main reasons:
1. For easy and simpler definition of the functions. There would be one pointer who will call the function every time is needed in the program.
2. For easier comparisons of parameters.
4 0
4 years ago
Which line of code will use the overloaded multiplication operation?
maks197457 [2]

Answer:

def __mul__(self, b):

Explanation:

correct edge 2021

4 0
3 years ago
System testing: A. includes all the preparations for the series of tests to be performed on the system. B. tests the functioning
hichkok12 [17]

Answer:

B. tests the functioning of the system as a whole.

Explanation:

System testing is an integral part of system development.

Testing is all about ascertaining the functionality of the system to meet the initial functionality designed before.

From the options, the best answer that suite the definition of system testing is:

B. tests the functioning of the system as a whole.

System testing test the functioning of the system as a whole. It check the functionality of individual part and how it relate or inter-operate with other part in the entire system.

4 0
3 years ago
The definition of network is:
kondaur [170]

\text{Hello there!}

<u>Networks were originally used as a government weapon 61 years ago</u> to <u>communicate information</u> such as data and research. However, individual networks were eventually discontinued by the government and made open to the public to use for things such as PAN, LAN, MAN, WAN, SAN, and so on.

<u>Our internet today is capable of communicating with bilions of computers.</u> This is possible due to your modem using radio wave-like speeds to connect to your ISP. Your ISP then connects to a larger network, which is connecting to thousands of other networks. You see, <u>the internet is just a large network of networks that are connected through very fast radiowaves</u>. However, it is not just a single network being used anymore; it's thousands of them. The term, "internet" was used to describe this large selection of networks. In short, <u>B</u><u> would be incorrect. </u>

The worldwide web is a protocol used by the internet to connect to select websites favourably from whoever's using it. This obviously would not define the network, as this is something that's used by it. Furthermore, <u>A</u><u> would not be correct.</u>

As described already, the network was a selection of computers used to communicate information to each other. <u>C </u><u>would not be correct </u>as it states that there is only one computer being used.

\fbox{Therefore, D would be the correct answer.}

\rule{300}{1.5}

6 0
3 years ago
Other questions:
  • Sheela often forgets what she needs to do throughout the day, and she misses meetings and deadlines to submit reports. Which ema
    6·2 answers
  • To type the letter address, _________ space from the dateline
    9·2 answers
  • Su
    6·1 answer
  • What mistake is in the following code?
    13·1 answer
  • Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week. For thi
    10·1 answer
  • The __________ utility has the capability to manage users, create and administer user groups, and apply user rights to those use
    8·1 answer
  • My PC won't output any data does anyone have any ideas​
    9·1 answer
  • Which scenario describes unethical lab behavior?
    9·1 answer
  • Which of these purchases is most likely to be paid for with a credit card
    13·1 answer
  • What changes the size of a video when played?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!