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
Type the correct answer in the box. Spell all words correctly. Complete the sentence based on the role education plays to help y
CaHeK987 [17]

Answer:

what do i do??

Explanation:

8 0
3 years ago
The value 8/10 in a cell refers to which of these?
AleksAgata [21]
D. all of these, since it depends on how the cell is formatted.
8 0
3 years ago
Read 2 more answers
100+20000000 please give answer and win iPhone 11 pro​
Eddi Din [679]

Answer:

20000100

Explanation:

8 0
2 years ago
"when a dynamic web page is requested, the web server passes the request to"
nalin [4]
System operations of the website u are  asking to access
7 0
3 years ago
What is the difference between above ground mining and underground mining?
neonofarm [45]
If this is in reference to diamond mining then above ground would be panning while below ground would be the actual mining into the soil. 
6 0
2 years ago
Other questions:
  • Ben chang noticed that his store was lagging in sales . He realized that his staff was not experienced enough . As the store man
    13·2 answers
  • Once Google Analytics processes data, it’s stored in a database where it can’t be modified.
    9·1 answer
  • Your license can be canceled if you __________
    9·2 answers
  • If you were doing a regular expression inside a Linux command line, which special character on the keyboard would give you two p
    13·1 answer
  • The hardware to keep the output data when finished is a
    9·1 answer
  • What is GIGO ?<br>plz answer me​
    7·1 answer
  • Task 1
    9·1 answer
  • Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The drive is currently serving a request at cylinder 2,150,
    6·1 answer
  • To find information on a network use a ____
    14·1 answer
  • What types of company functions are aided by ERP?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!