Using the knowledge in computational language in JAVA it is possible to write a code that enter a series of 10 integers and then determines and displays the largest and smallest values entered.
<h3>Writting the code in JAVA:</h3>
<em>public class OddEvenSum { </em><em>// Save as</em><em> "OddEvenSum.java"</em>
<em> public static void main(String[] args) {</em>
<em> </em><em> // Declare variables</em>
<em> final int LOWERBOUND = 1;</em>
<em> final int UPPERBOUND = 1000; // Define the bounds</em>
<em> int sumOdd = 0; // For accumulating odd numbers, init to 0</em>
<em> int sumEven = 0; // For accumulating even numbers, init to 0</em>
<em> int absDiff; // Absolute difference between the two sums</em>
<em> // </em><em>Use a while loop</em><em> to accumulate the sums from LOWERBOUND to UPPERBOUND</em>
<em> int number = LOWERBOUND; // loop init</em>
<em> while (number <= UPPERBOUND) { // loop test</em>
<em> // number = LOWERBOUND, LOWERBOUND+1, LOWERBOUND+1, ..., UPPERBOUND</em>
<em> // A if-then-else decision</em>
<em> if (number % 2 == 0) { // Even number</em>
<em> sumEven += number; // Same as sumEven = sumEven + number</em>
<em> } else { // Odd number</em>
<em> sumOdd += number; // Same as sumOdd = sumOdd + number</em>
<em> }</em>
<em> ++number; // loop update for next number</em>
<em> }</em>
<em> // </em><em>Another if-then-else</em><em> Decision</em>
<em> if (sumOdd > sumEven) {</em>
<em> absDiff = sumOdd - sumEven;</em>
<em> } else {</em>
<em> absDiff = sumEven - sumOdd;</em>
<em> }</em>
<em> // OR </em><em>using one liner </em><em>conditional expression</em>
<em> //absDiff = (sumOdd > sumEven) ? sumOdd - sumEven : sumEven - sumOdd;</em>
<em> </em>
<em> // </em><em>Print the results</em>
<em> System.out.println("The sum of odd numbers from " + LOWERBOUND + " to " + UPPERBOUND + " is: " + sumOdd);</em>
<em> System.out.println("The sum of even numbers from " + LOWERBOUND + " to " + UPPERBOUND + " is: " + sumEven);</em>
<em> System.out.println("The absolute difference between the two sums is: " + absDiff);</em>
<em> }</em>
<em>}</em>
See more about JAVA at brainly.com/question/12975450
#SPJ1