Question: The code must be well commented! Update an array (5 points) Instructions Write a program that has a method called updateArray It takes in an

The code must be well commented!

The code must be well commented! Update an array (5 points) Instructions

Update an array (5 points) Instructions Write a program that has a method called updateArray It takes in an array of integers and a value (an int). The method will go through the array of integers and add each element by the value passed in. It does NOT return the array. For example if the method gets an array with 3 values: 10, 15, 20 and the value 2, then the array would then contain: 12, 17, 22. Then in the main method, use a Scanner object to first read in a number that represents the size (n) of an array of integers. Create an array of integers that uses the first number as the size. You will then read in (n) values all on the same line and store them in the array. Finally, you will read in one last int (out of the range of (n) which represents the int to pass into the method. The program then calls the method updateArray and passes in the integer array and the last int. The main method will then print out the array after the method Details Input A sequence of integers: the size n of the array, the array elements then the number to add Output The updated array Example Sample Input Sample Output 412 10 21 30 17 15 26 35 52 416 102 463812 Problem4 Check It

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!