Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started