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
vredina [299]
3 years ago
12

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer

s that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100
Computers and Technology
1 answer:
Rainbow [258]3 years ago
8 0

Answer:

Explanation:

The following is coded in Java. It asks the user for the number of inputs and then creates a loop to read all of the inputs and adds them to an ArrayList. Then it saves the last value in the array as the threshold. Finally, it loops through the array printing only the values less than or equal to the threshold. The program has been tested and the output can be seen in the image below.

import java.util.ArrayList;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       ArrayList<Integer> myList = new ArrayList<>();

       System.out.println("How many inputs will you add? ");

       int inputs = in.nextInt();

       System.out.println("Enter inputs: ");

       for (int i = 0; i< inputs; i++) {

           int num = in.nextInt();

           myList.add(num);

       }

       int threshold = myList.get(myList.size()-1);

       System.out.println("Inputs Less than or Equal to Threshold: ");

       for (int x: myList) {

           if (x <= threshold) {

               System.out.println(x);

           }

       }

   }

}

You might be interested in
Within an event-driven program a component from which an event is generated is the ____
mojhsa [17]
The answer is: <span>Source of the Event</span>
7 0
3 years ago
WHAT DOES INFORMATION TECHNOLOGY DO??<br> Do they offer services or products
notsponge [240]
Yes

Explanation: Information technology, or IT, describes any technology that powers or enables the storage, processing and information flow within an organization. Anything involved with computers, software, networks, intranets, Web sites, servers, databases and telecommunications falls under the IT umbrella.
4 0
2 years ago
HELP 15 POINTS
masya89 [10]

Answer:

A I think I might be wrong

6 0
3 years ago
Read 2 more answers
Requirements description:
Andrews [41]

Answer:

The code has been written in Java.

The source code of the file has been attached to this response. The source code contains comments explaining important lines of the program.

A sample output got from a run of the application has also been attached.

To interact with the program, kindly copy the code into your Java IDE and save as Cafe.java and then run the program.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
75f69c356ebff0797de4ffcfb6f8c22e.png
8 0
3 years ago
Which of the following tasks is least effective at preventing a computer virus A. Anti-virus's software up to date
MaRussiya [10]
C is your answer
hope that helps
4 0
3 years ago
Read 2 more answers
Other questions:
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • According to the appendix what was the purpose of newspeak
    12·1 answer
  • True or False <br><br> Rootkits are only made by black-hat hackers.
    8·1 answer
  • . What is the difference between a combinational circuit and sequential circuit? Give example of each.
    8·1 answer
  • Given an array a, write an expression that refers to the first element of the array .
    5·1 answer
  • What is a common translator?​
    9·1 answer
  • If 209g of ethanol are used up in a combustion process, calculator the volume of oxygen used for the combustion at stp​
    5·1 answer
  • What defines the scope of a project?
    5·1 answer
  • Can somebody please help me with these few questions?
    11·1 answer
  • Assume the name of your data frame is flavors_df. What code chunk lets you review the structure of the data frame?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!