Create an array with a size of an integer number

Assignment Help Computer Engineering
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.

Reference no: EM132169241

Questions Cloud

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?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd