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
Maslowich
3 years ago
12

Implement the ArrayMethod application containing an array that stores eight integers. The application should call the following

five methods: 1. display - should display all the integers 2. displayReverse - should display all the integers in reverse order 3. displaySum - should display the sum of the integers 4. displayLessThan - should display all values less than a limiting argument 5. displayHigherThanAverage - should display all values that are higher than the calculated average value.
Computers and Technology
1 answer:
AveGali [126]3 years ago
8 0

Answer:

public static void display(int [] arr){

   System.out.print("Arrays: ");

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

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static void displayReverse (int [] arr){

   System.out.print("Arrays in reverse order: ");

       for(int i=arr.length-1;i>=0;i--){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static int displaySum (int [] arr){

   System.out.print("Sum: ");

   int sum = 0;

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

           sum+=arr[i];

       }

       return sum;

   }

   

public static void displayLessThan (int [] arr, int num){

       System.out.print("Less than "+num+": ");

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

           if(arr[i]<num){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

public static void displayHigherThanAverage  (int [] arr){

       System.out.print("Higher than average: ");

       int sum = 0;

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

           sum+=arr[i];

       }

       float average = sum/arr.length;

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

           if(arr[i]>average){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

Explanation:

<em>The methods were written in Java. See attachment for explanation where I used comments to explain each lines.</em>

<em>Note that lines that begin with double slash (//) are comments</em>

Download txt
You might be interested in
WILL MARK BRAINLIEST HELP
hichkok12 [17]

My guess would be A.

3 0
3 years ago
Read 2 more answers
Which tab do you select to change how you see your Word document on screen?
seraphim [82]

Answer:view

Explanation:i just took the test

8 0
3 years ago
Read 2 more answers
Does anyone know what the name of the game is, where you click on the grey dots in a 3x3 grid and try to make them all the same
antoniya [11.8K]

Answer:

Its the pattern puzzle game.

Explanation:

The answer is straight forward. Its a pattern puzzle game, and here we need to change everything to same color, and that is a pattern of this pattern game. Many forms of such pattern games are available, but this one happens to be the most popular among them all, and is widely used by various people of all ages to pass their time.

3 0
3 years ago
Read the paragraph.
aleksandrvk [35]

Answer:

I think sentence 3 bc it doesn't really make any sense Ik it's explaining it but it doesnt connect with the whole story as much I think it has to have more details

5 0
3 years ago
Read 2 more answers
What is an input, output and storage device?
stiv31 [10]
I phone because it stores things hil sends out things to other people
5 0
3 years ago
Other questions:
  • To move to the most extreme right cell containing data in your worksheet, what basic key combination can you use?
    7·1 answer
  • After modifying a numbered list in her presentation, Su notices the numbers and the text are too close to each other. She knows
    9·1 answer
  • Design a new Triangle class that extends the abstract
    13·1 answer
  • Are the actions legal or illegal?
    13·1 answer
  • What is the difference between private inheritance and composition?
    11·1 answer
  • Pleasee help. How do you fix this problem in discord?
    10·1 answer
  • What is the purpose of file extensions? A. They execute the mail merge function, B. They tell the operating system what kind of
    15·2 answers
  • Type the correct answer in each box. Spell all words correctly, and use numerals instead of words for numbers. If necessary, use
    6·1 answer
  • The three main objectives of information security are
    5·1 answer
  • Missing appropriate security hardening across any part of the application stack or improperly configured permissions is an examp
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!