This activity will enable you to apply what you will learn during this course. You need to write a program for the instructions given below:

Create an application containing an array that stores 10 integers. The application should call five methods that in turn (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the integers, (4) display all values less than a limiting argument, and (5) display all values that are higher than the calculated average value. Then, create another array that store 5 integers. Pass the two arrays to a method that will display the integer value(s), if any, that appear in both arrays (note that the two arrays can have no stored values in common). Save the file as ArrayMethodDemo.java.

Discussion

Arrays enable the representation of a number of similar items (in terms of their datatypes). They represent these items in an ordered list. Consider the features of arrays and respond to the following:

  • In what programming situations would the use of an array be beneficial?
  • What situations would not warrant the use of an array? Provide an example explaining why?
  • Imagine a programming structure that would deal with these problems. What characteristics should the structure possess?
  • Research the concept of class ArrayList in Java. Describe the advantage of using the ArrayList class over an array. Also discuss in what circumstances you should use one over the other. Please use examples to justify your answers.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.