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
Write code which takes inputs and creates two Rectangle objects (using the edhesive.shapes.Rectangle class) and compares them us
iogann1982 [59]

Answer:

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

Scanner scan = new Scanner(System.in);

Double x = scan.nextDouble();

System.out.println("Enter 2 lengths:");

Double a = scan.nextDouble();

Double b = scan.nextDouble();

Rectangle rect = new Rectangle(x);

Rectangle rect2 = new Rectangle (a,b);

if (rect2.equals(rect)){

 System.out.print("Congruent Rectangles");

}

else {

 System.out.print("Different Rectangles");

}

 }

}

Explanation:

6 0
3 years ago
What is the easiest way of ensuring that others can access a presentation that a user has created and make changes to it, while
Yakvenalex [24]

Answer:

You can share the presentation with your group. Share the presentation with everyone by email so everyone can work on it at once. Give your group members their own part to work on.

Explanation:

4 0
4 years ago
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
2 years ago
Which of the following is the single best rule to enforce when designing complex passwords?
saw5 [17]

Answer:

B. Longer passwords

Explanation:

If the password is longer, it requires more incorrect attempts to find it, so the system could identify a potential hacker attempt. Smaller but more complex passwords could be identified by mistype or forgotten passwords.

3 0
3 years ago
Create a float variable named diameter. This variable will hold the diameter of a circle. d. Create a float variable named PI.
Basile [38]

Answer:

float diameter=2*r; //hold the diameter of a circle

float PI; // float variable named PI.

Explanation:

Here we have declared two variable i.e diameter and PI of type float. The variable diameter will hold the diameter of a circle i.e  2*r  where r is the radius of a circle.

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

   float r=9.2; // variable declaration

float diameter=2*r; //hold the diameter of a circle

float PI=3.14; // float variable named PI hold 3.14

cout<<"diameter IS :"<<diameter<<endl<<"PI IS :"<<PI; // display value

  return 0;

}

Output:

diameter IS :18.4

PI IS :3.14

8 0
3 years ago
Other questions:
  • The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case a
    15·1 answer
  • Paragraph: Read the following two e-mail messages. In three to five sentences, explain why E-mail B is the more appropriate work
    5·1 answer
  • Can someone text me cuss I'm bored my number is (225) 975 7120
    10·1 answer
  • The length, height, and width of a cube are 10, 7, and 5 cm respectively. Write a program that calculates the volume, perimeter,
    9·1 answer
  • A ______ is a personal computer which stays in one location (e.g. office) due to its larger form factor.
    5·1 answer
  • During an upgrade for a new web server, Glen's company experienced a power surge. The power surge hit the new server, and now th
    10·1 answer
  • You need to buy a cable to connect a desktop PC to a router. Which cable should
    13·1 answer
  • Jenny, a programmer, uses Microsoft Excel 2016 to generate data required for the programs she develops. She uses various functio
    10·1 answer
  • Computer identity theft differs from theft in the real world in what major way?
    11·2 answers
  • why are microphones or digital cameras unlikely to cause the damage that is found in repetitive strain injury?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!