Question: in this program make sure the existing code doesnt chagne. here it is in text import java.util.*; public class ArraySum { public static Scanner kbd;


![Scanner kbd; public static void main(String[] args) { kbd = new Scanner(System.in);](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f517e3589c5_46666f517e2eccbb.jpg)
in this program make sure the existing code doesnt chagne. here it is in text
import java.util.*;
public class ArraySum {
public static Scanner kbd;
public static void main(String[] args) {
kbd = new Scanner(System.in);
kbd.close();
}
/**
* Fill an array with values entered by the user at the keyboard. At the start of
* the method, the array is assumed to already be initialized. At the end of the
* method, the array will be holding all values entered at the keyboard.
* @param nums An array to hold the numbers which will be entered
*/
public static void getNums(int [] nums) {
System.out.println("Enter " + nums.length + " integers, one per line:");
for(int pos = 0; pos
nums[pos] = kbd.nextInt();
}
}
/**
* Compute the sum of all integers in an array
* @param nums An array holding the integers to be summed
* @return The sum of the integers in the array
*/
public static int computeSum(int [] nums) {
int sum = 0;
for(int pos = 0; pos
sum += nums[pos];
}
return sum;
}
}
Create a mew Java Crass calleu. AIray Sum Write a program that reads integers, one per line, and displays their sum. After displaying the sum, display all the numbers in the array, each with an annotation giving its percentage contribution to the sum Begin by asking the user for the number of integers which will be entered. Once you have this number, create an array of that size. Next ask the user to enter the integers, storing them into the array as they are entered After all numbers have been entered, print to the screen: the sum, and then the list of the numbers along with the percentage the number is of the sum rogram runs. The The following is an example of what your MIGHT see on the screen when your p exact output depends on what values that the user types in while the program runs. Please be sure that you test ALL of the examples shown below with your program. The user's inputted values are shown below in italics How many numbers will you enter? Enter 4 integers, one per line: 2 The sum is 6. The numbers are: 2, which is 33.3333% of the sum . 1, which is 16.6667% f the sum. 1, which is 16.6667% of the sum . 2, which is 33.3333% of the sum . Technical Notes & Hints: Use the System. out.printf method to make the percentages print exactly 4 decimal places .A version of the getNums method has already been included in your starter code. This method which was discussed in class, fills an array with values entered at the keyboard. You are expected to use this method to fill your array with values The compute Sum method has already been included in your starter code. This method, which was discussed in class, computes the sum of all integers in an array. You are expected to use this method to calculate the sum of the items in your array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
