Reference no: EM132169241
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.
Solve ethical problems through the legal system
: It seems that our society has a great inclination to solve ethical problems through the legal system.
|
How many minutes does the average customer wait in line
: The cashier can then process 1.25 customers per minute. On average, how many minutes does the average customer wait in line?
|
Create a graphical user interface using j frame to insert
: Create a graphical user interface (GUI) using J Frame to insert, update and view information for at least one of the classes you have created.
|
Write a program that reads in a css file and parses
: Write a program that reads in a css file and parses each line into a string array using string split. You will create an employee scheduler program.
|
Create an array with a size of an integer number
: 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).
|
Accept a one-dimensional array of double and returns
: Using Java: Write a method, averageArray, that accepts a one-dimensional array of double and returns the average of the numbers in the array.
|
Make an argument that it is enticement
: When using honeypots and honeynets, administrators should be careful not to run afoul of any legal issues.
|
Write software that simulates a game of duck duck goose
: The person who is "it" pats each child on the head, saying "Duck" each time, until randomly reaching a child that the "it" person identifies as "Goose."
|
Write the condition guarantees that a doubly linked list
: Write the condition, if true, guarantees that a doubly linked list with head and tail nodes is empty?
|