Question: 11.4 in your book (Maximum element in ArrayList) Write the following method that returns the maximum value in an ArrayList of integers. The method returns

 11.4 in your book (Maximum element in ArrayList) Write the following

11.4 in your book (Maximum element in ArrayList) Write the following method that returns the maximum value in an ArrayList of integers. The method returns null if the list is null or the list size is 0. public static Integer max (ArrayList list) You will use the above declaration in your program. Write a test program that prompts the user to enter a sequence of numbers ending with 0, and invokes this method to return the largest number in the input Logic Hints: a. Ask user for input. Ex. 23 4 8 96 13 0 b. Use a loop (while, Do-while, etc.) to check to see if the value is 0. If it's not, add it to the array Using the add0 method on arrays. c. Create a method that will go through the array list to find the max value (for loop is best). The method should return the highest value. In the example above, it should return 96 as the highest value. d. Print out the highest value. 1. All programs must be well documented (name, data, description of program, other comments of 2. Source code must be turned in (pasted in a text file or word document) to be compiled by the Instructo. 3. Include a screen shot of the working program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!