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
2 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]2 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
You are asked to install a device that will combine several connections to the Internet and provide the sum of the available net
ch4aika [34]

Answer:

load balancer.

Explanation:

Based on the scenario being described within the question it can be said that you are being asked to install a load balancer. This is a device that behaves as a reverse proxy in order to correctly and efficiently distribute all the network traffic across various servers in order to increase the amount of users that can use the server at the same time.

8 0
3 years ago
Read 2 more answers
Adjusting the ______ adjusts the difference in appearance between light and dark areas of the photo.​
Svetach [21]

Answer:

contrast

Explanation:

4 0
3 years ago
Read 2 more answers
Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho
katen-ka-za [31]

Answer:

import java.util.Scanner;

public class BasicInput {

   public static void main(String[] args) {

       //Create an object of the Scanner class

       Scanner scnr = new Scanner(System.in);

       

       //Define int and double variables

       int userInt;

       double userDouble;

       

       //Define char and string variables similarly

       char userChar;

       String userString;

       

       //Prompt the user to enter an integer

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

       //Store the input in the integer variable

       userInt = scnr.nextInt();

       

       //Prompt the user to enter a double

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

       //Store the input in the double variable

      userDouble = scnr.nextDouble();

       

       //Prompt the user to enter a char

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

       //Store the input in the char variable

      userChar = scnr.next().charAt(0);

       

       //Prompt the user to enter a string

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

       //Store the input in the string variable

      userString = scnr.next();

       

       //Output the four values on a single line

       //separated by a space

       System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString);

       

   }

   

}

Sample Output:

Enter integer:

>>12

Enter double:

>>23

Enter char:

>>s

Enter String:

>>asdasd

12 23.0 s asdasd

Explanation:

The code above has been written in Java. It contains comments explaining every part of the code. Please go through the comments.

5 0
2 years ago
Why is it important to have a price assiociated in every product​
artcher [175]

Answer:

The wrong price can also negatively influence sales and cash flow. tbh there is no point to me  

Explanation:

7 0
2 years ago
Read 2 more answers
Which statement is true? Select 3 options.
irina1246 [14]

Answer:

The statements which are true are;

  • A user-defined data type can include other user-defined data types
  • A user-defined data type is defined using a class
  • A user-defined data type can include a list

Explanation:

A user-defined data type (UDT) is a datatype that is defined and derived by the use of the datatypes which preexist including existing user-defined datatypes and the built-in datatypes

It is therefore true that a user-defined data type can include other user-defined data types

A class is a user-defined data type that contains both its member data and member functions, that can be used when an instance of the class is first created

Therefore, a user-defined data type is defined using a class

In a user-defined data type, a variable has actual data within it which can include an array or list

Therefore a user-defined data type can include a list.

3 0
2 years ago
Read 2 more answers
Other questions:
  • when seeking information on the on the internet about a variety of subjects the most useful place to look would be?
    13·1 answer
  • In your own words, explain the role of scientific investigation in the development of the Theory of Evolution.
    6·1 answer
  • Match the items.
    15·1 answer
  • Who is the last person appointed to the u.s supreme court
    11·1 answer
  • Controlled intersections use some form of which of the following:
    7·1 answer
  • 99 points!!! What would happen to the document if the change “A” is pointing to was accepted? a. There would be no changes. b. “
    6·2 answers
  • Which feature enables you to make changes to all the slides of your presentation at the same time?
    15·2 answers
  • What was bill gates first operating system he created?
    7·1 answer
  • Credible sites contain __________ information,
    7·2 answers
  • Fictional Corp has a data center that runs multiple internal applications. However, they want to migrate their email to a cloud
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!