Question: This program will take advantage of methods written in the Help.java class. In other words you will have two files to work with ArraSum.java and

 This program will take advantage of methods written in the Help.java

This program will take advantage of methods written in the Help.java class. In other words you will have two files to work with ArraSum.java and a helper class Help.java. You can switch between files by clicking on their names in the left panel in 'work' folder. First, you will write a new method in Help.java. This method will be named: addArray() and will accept an array of integers as input. This method will calculate the sum of all values in the array and return the resulting sum. Remember that the array being passed to the method may be of ANY length. (Use the existing methods in the Help.java class to help you remember how to do this.) Now, in a program named: ArraySum.java, you will ask the user for the number of values s/he intends to input, then create an array of integers of the specified size. Do NOT create Scanner object and use nextinto) in ArraySum.java. Instead, use the methods already created for you in Help.java, to help with this task! After creating the array.fill your array with positive values from the user, then print the array (again use methods from the Help class). Use your new method to calculate the sum of all elements, and then print the sum to the screen. Sample 1/0 (user input in italics): How many numbers would you like to enter? Enter a positive integer (>=0): -5 Enter a positive integer (>=0): 3 Enter a positive integer (P=0): 7 Enter a positive integer (>=0): 4 Enter a positive integer (>=0): 3 17.4.3) 14 This program will take advantage of methods written in the Help.java class. In other words you will have two files to work with ArraSum.java and a helper class Help.java. You can switch between files by clicking on their names in the left panel in 'work' folder. First, you will write a new method in Help.java. This method will be named: addArray() and will accept an array of integers as input. This method will calculate the sum of all values in the array and return the resulting sum. Remember that the array being passed to the method may be of ANY length. (Use the existing methods in the Help.java class to help you remember how to do this.) Now, in a program named: ArraySum.java, you will ask the user for the number of values s/he intends to input, then create an array of integers of the specified size. Do NOT create Scanner object and use nextinto) in ArraySum.java. Instead, use the methods already created for you in Help.java, to help with this task! After creating the array.fill your array with positive values from the user, then print the array (again use methods from the Help class). Use your new method to calculate the sum of all elements, and then print the sum to the screen. Sample 1/0 (user input in italics): How many numbers would you like to enter? Enter a positive integer (>=0): -5 Enter a positive integer (>=0): 3 Enter a positive integer (P=0): 7 Enter a positive integer (>=0): 4 Enter a positive integer (>=0): 3 17.4.3) 14

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!