Question: BY USING JAVA Eclipse without using null BY USING : Loops Int Random Return arrays QUESTION Create an array with a size of an integer

BY USING JAVA Eclipse

without using null

BY USING :

Loops Int Random Return

arrays

QUESTION

Create an array with a size of an integer number, n. n will be generated as a random integer number in the interval between 3 and 10 (both included). Also, generate random numbers to fill the array. These numbers must be in the interval between 1 and 20 (both included). Then, find if this array is a Winner or a Loser. Considering every element in the array, check if there is any element which has the equal summation of the elements in the left-hand side and in the right-hand side. If there is at least 1 element in this array which satisfies this condition, print Winner. Otherwise, print Loser. You need to check every element in the array if there exists an element to satisfy this condition or not. If there are no elements on the left or right-hand sides, then take the summation as zero. Considering every element in the array, check if sum of the elements in the left-hand side is equal to the sum of the elements in the right-hand side, this array has a Victory. If this condition is satisfied, say Winner to user. Otherwise, say Loser. You need to check all elements in the array if there exists an element to satisfy this condition or not. If there are no elements to the left or right, then take the summation as zero.

Output Format

Display the size of the array and the elements of the array when it is filled by random numbers. Display Winner if there exist at least one element in the array, such that the sum of the elements on its left-hand side and the sum of the elements on its right-hand side are equal. Otherwise display Loser.

SAMPLE OUTPUTS

Sample Output 1

4 elements in the array

Elements: 1, 2, 3, 3

Winner

Explanation 1

Element in 2 nd index satisfies the given condition (1 + 2 = 3).

Sample Output 2

8 elements in the array

Elements: 2, 5, 3, 3, 5, 8, 12, 6

Winner

Explanation 2

Element in 5 th index satisfies the given condition (2 + 5 + 3 + 3 + 5 = 12 + 6).

Sample Output 3

5 elements in the array

Elements: 6, 9, 2, 1, 20

Loser

Explanation 3

No elements in the array that satisfies the given condition.

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!