Exercise 2 - Numbers Create a new class called Numbers that contains a method called nextLargest. This method should accept an array of numbers and an integer, and output the next bigger number that...

Use java.Exercise 2 - Numbers<br>Create a new class called Numbers that contains a method called nextLargest. This<br>method should accept an array of numbers and an integer, and output the next bigger number<br>that is found in the array or the maximum possible int value, if none are larger. Using this<br>method in main to iterate through all values in a predefined array, and output the next largest<br>number.<br>For example, if the array is<br>{78, 22, 56, 99, 12, 14, 17, 15, 1, 144, 37, 23, 47, 88, 3, 19}<br>the output should look like the following (? is a placeholder):<br>78: 88<br>22: 23<br>56: 78<br>99: 144<br>12: 14<br>14: 15<br>17: 19<br>15: 17<br>1: 3<br>144: 2147483647<br>37: 47<br>23: 37<br>47: 56<br>88: 99<br>3: 12<br>19: 22<br>NOTE 1: If there is no bigger number in the sequence, just display the value of<br>Integer.MAX_VALUE. This is a constant this automatically defined as a static variable inside<br>the Integer class.<br>NOTE 2: ? should be replaced with the appropriate number<br>

Extracted text: Exercise 2 - Numbers Create a new class called Numbers that contains a method called nextLargest. This method should accept an array of numbers and an integer, and output the next bigger number that is found in the array or the maximum possible int value, if none are larger. Using this method in main to iterate through all values in a predefined array, and output the next largest number. For example, if the array is {78, 22, 56, 99, 12, 14, 17, 15, 1, 144, 37, 23, 47, 88, 3, 19} the output should look like the following (? is a placeholder): 78: 88 22: 23 56: 78 99: 144 12: 14 14: 15 17: 19 15: 17 1: 3 144: 2147483647 37: 47 23: 37 47: 56 88: 99 3: 12 19: 22 NOTE 1: If there is no bigger number in the sequence, just display the value of Integer.MAX_VALUE. This is a constant this automatically defined as a static variable inside the Integer class. NOTE 2: ? should be replaced with the appropriate number

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here