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
Is frequency measured in henry.
soldier1979 [14.2K]
No its measured in Hertz Hz
5 0
3 years ago
A new drug to combat acne has been developed from a compound that is found in a melon. Which scientists would contribute to the
Ann [662]
The correct answer for this question is this one: "B. biologists and chemists."  A new drug to combat acne has been developed from a compound that is found in a melon. The <span>scientists would contribute to the development of the drug are biologists and chemists.
</span>
Here are the choices:
A. <span>chemists only
B. biologists and chemists
C. biologists, chemists, and physicists
D. biologists, chemists, and physicians</span>
8 0
3 years ago
Read 2 more answers
How do u get rid of this (the grey box)
slamgirl [31]

Answer:

can't helpnyounddjdjzjzjsjejs jvm d

8 0
3 years ago
Read 2 more answers
What is the target audience for this poster?
bija089 [108]

Answer:

there is no car on a bus a bus is one long vehicle

Explanation:

7 0
3 years ago
Read 2 more answers
The second letter of the Koeppen letter code gives information about:
lukranit [14]

Answer:

a. the precipitation characteristics of the climate subtype.

Explanation:

The second letter in the code represents the detailed seasonality of precipitation, it shows when during the seasons precipitation comes to that climate.

6 0
3 years ago
Other questions:
  • The four functions of a computer are
    5·1 answer
  • What is the part of the browser window that displays the content of the web page such as pictures and text called?
    10·1 answer
  • What are the features of a strong résumé? Check all that apply.
    7·1 answer
  • Prewritten, commercially available sets of software programs that eliminate the need for a firm to write its own software progra
    7·1 answer
  • What is the best data structure to solve the following problem? a) A list needs to be built dynamically. b) Data must be easy to
    11·1 answer
  • int temp; temp = 180; if ( temp &gt; 90 ) { System.out.println( "This porridge is too hot." ); // cool down temp = temp – ( temp
    9·1 answer
  • Write a formula that would return a TRUE result if the sum of the first five numbers in a column of data are negative
    7·1 answer
  • 01110101<br> +00100100<br> 00010001
    8·1 answer
  • Which of the following tells the computer hardware what to do? A Information B) Software Procedures D People
    12·2 answers
  • Darla is going to start writing the HTML code for a web page. What would she start with?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!