Project: Given an array numbers. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the...

90.2K

Verified Solution

Question

Programming

Project:

Given an array numbers.We define a running sum of an array as runningSum[i]= sum(nums[0]…nums[i]).

Return the running sum of numbers.

Example:

Input: nums=[1,2,3,4]

Output: [1,3,6,10]

Explanation: Runningsum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4].

You need todo: Create aclass called RunningSumArrayto perform the mainmethod. Create a class calledArrayOperationto hold the actions forarray. In this project, you willneed 4methods:

1.Publicstatic Int[] getArray() --- inside ArrayOperationclass,using loop generatea nitemsarray.
2.Public staticvoidrunnungSum(int[] inputArray) --- inside ArrayOperationclass,process the arrayto calculate the sums. An array is anobject, passing anarray to a method is passing by reference.
3.Public staticvoidprintArray(int[] result) --- inside ArrayOperationclass,print the array ina [1, 2, 3, 4, 5] form.
4.Public staticvoidmain(string[] args) --- Prompt user to input awhole number between 5 and 10, using the user input number togenerate the array, perform calculation, andprint out the arraybefore and after calculation,

Answer & Explanation Solved by verified expert
4.1 Ratings (818 Votes)
CodeArrayOperation classimport    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students