Question: Problem 3 . - Write a program that has the class name Problem 3 and that has the main method. Leave the main method empty
Problem
Write a program that has the class name Problem and that has the main method. Leave the main method empty for now.
Write a method named greaterThanSum that takes one parameter, an integer array a and returns a new integer array x
The method finds all the terms of an array a that are greater than the sum of all previous terms of the sequence. If there are no such elements, you can return an empty array.
Several sample usages are provided for you below. Use the sample usages in the main method to test your code. Create a printArray method that takes an integer array as a parameter and prints out the elements of the array on the same line separated by a comma and space.
begintabularlc
hline multicolumnc Sample Method Usage & Return value
hline begintabularl
int a ;
int x greaterThanSuma;
endtabular &
hline begintabularl
int a ~ ;
int x greaterThanSuma;
endtabular &
hline begintabularl
int a;
int x greaterThanSuma;
endtabular &
hline begintabularl
int a;
int x greaterThanSuma;
endtabular &
hline
endtabular
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
