Question: (Java Programmin): Sum() and max() in ArrayList a. Write a method that returns the maximum value in an ArrayList of integers. The method returns null

(Java Programmin):

Sum() and max() in ArrayList

a. Write a 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)

b. Write a method that returns the sum of all numbers in an ArrayList:

public static Integer sum(ArrayList list)

c. Write a test program that prompts the user to enter a sequence of numbers ending with 0, and invokes sum and max methods to output the sum and the largest number in the input.

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!