Question: Done in Java. Any help appreciated! 2: Min-Max Strings Find the minimum and maximum values of an ArrayList of Integers , which was generated using

Done in Java. Any help appreciated!

2: Min-Max Strings

Find the minimum and maximum values of an ArrayList of Integers, which was generated using an ArrayList of Strings.

Implementation Details:

1. Take the size of the list N and list of N strings as the user input using Scanner. (Alternatively, you can write a Random String Generator method for a given N)

2. Store these N strings in an ArrayList.

3. Now, for each string in this ArrayList, calculate the sum of ASCII values of all the characters in that String and store that sum in an anotherArrayList.

4. Now, find the minimum and maximum values from thisArrayList.

5. Store those 2 values in an Array in the following order {minValue, maxValue} and return thisArray.

6. Also, write JUnit tests.

Examples:

Input: N = 3

myArrayList = {John, Nick, Alex}

sumArrayList = {399 , 389 , 394}

Output: [389,399]

SumArrayList calculation - > J ( 74 ) + o ( 111 ) + h ( 104 )+ n ( 110 ) = 399 ,

Similarly, calculate sum for other strings.

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!