A method sumWithoutLargest that computes the sum of an array of integer values, except for the largest
Fantastic news! We've Found the answer you've been seeking!
Question:
A method sumWithoutLargest that computes the sum of an array of integer values, except for the largest one, in a single loop. In the loop, update both the sum and the largest value. After the loop, return the difference.
Write another method swapLargestSmallest that searches for the largest and smallest elements of an array of integer values and swaps them.
Finally write a test program to do the following:
- read the input of the integer array values
- invoke sumWithoutLargest method, display the sum and the resulting array.
- invoke swapLargestSmallest method, display the sum and the resulting array.
NEED THE CODE TO BE IN JAVA PROGRAMMING LANGUAGE.
Related Book For
Posted Date: