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
kkurt [141]
3 years ago
10

Implement a function named largerThanN that accepts three arguments: an array of type int, the size of the array of type int and

an int number n. The function should display all of the numbers in the array that are greater than the number n. in the main() function create an array named numbers containing 10 integers : 30,20,50,2,-1,44,3,12,90,32 Ask the user to enter a number. Call the the function largerThanN and pass the array , the size and the number that user entered.
Computers and Technology
1 answer:
levacccp [35]3 years ago
6 0

Answer:

import java.util.Scanner;

public class NewArray {

//Main Method begins here

   public static void main(String[] args) {

   int [] numbers = {30,20,50,2,-1,44,3,12,90,32}; //The given array

   Scanner in = new Scanner(System.in);

       System.out.println("enter a number");

       int n = in.nextInt(); //Receive the number from the user

       //Calling the method largerThanN

       largerThanN(numbers, numbers.length,n);

   }

//The method largerThanN begins here

   public static void largerThanN(int []intArray, int arraySize, int n){

       for(int i = 0; i < intArray.length; i++){

           if(intArray[i] > n){

               System.out.println(intArray[i]);

           }

       }

   }

}

Explanation:

Uisng the Java prograamming language the solution is provided above.

Please see the comments within the code for detailed explanation

The key logic within the method largerThanN () is using a for loop to iterate the entire array. Within the for loop use an if statement to compare each element with the the number n entered by the user

You might be interested in
Write a Bare Bones program that takes as input a value for X and places 4 times the value of X into the value of Z. The value of
Vlada [557]

Answer:

See the code snippet in the explanation section

Explanation:

import java.util.Scanner;

public class BareBonesProgram{

public static void main (String[] args){

 Scanner scan = new Scanner(System.in);

 System.out.println("Please enter the value of x: ");

 int x = scan.nextInt();

 int z = 4 * x;

 System.out.println("The value of z is: " + z);

 System.out.println("The value of x is: " + x);

}

}

6 0
3 years ago
When Jimmy Fallon is outside the White House, his persona is mostly O A. humble O B. stern O c. gloomy O D. wild​
horsena [70]

Answer:

a

Explanation:

7 0
3 years ago
HURRY HELP THIS IS FOR CODING !!!! What are some real-life situations that require a program that is iterative? Include at least
Degger [83]

Answer:

A health service, a sales service, a social network, all because they require you to make a request to return a result

5 0
3 years ago
Read 2 more answers
Provide the subnet, broadcast address and the valid host ranges for each of the
avanturin [10]

Answer:

You should now be able to give IP addresses to 254 hosts. This works fine if all 150 computers are on a single network. However, your 150 computers are on three separate physical networks. Instead of requesting more address blocks for each network, you divide your network into subnets that enable you to use one block of addresses on multiple physical networks

Explanation:

3 0
3 years ago
Electricity from has enough energy to stop your what?
Ne4ueva [31]

Can I get some options?


The second one is most likely "Heart", but the first one could be a number of things, unless this just pasted incorrectly.'


5 0
4 years ago
Other questions:
  • What is the name of the image window area that identifies the project you are working on?
    7·1 answer
  • Why should you follow up with your interview after a job interview
    15·2 answers
  • The sequence of folders to a file or folder is called a(n) ________
    8·1 answer
  • Write a program that finds the largest in a series of numbers entered by the user.The program must prompt the user to enter numb
    12·1 answer
  • Which best compares and contrasts broadcasting a slide show and sending the presentation as a PDF?
    10·1 answer
  • Which of the following statements about certificates is true?
    14·2 answers
  • ____________ occurs when a provider does not support data export or when a provider's service is unavailable through others.
    11·1 answer
  • Which software documentation guideline did the IEEE establish?
    10·1 answer
  • True or false<br>Y axis is also known as the value X.​
    9·2 answers
  • What is the term for delivering an application over the internet called?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!