Create an array of 100 integers using a random generator. ( 1 for loop) Provide the sum and average of the array. (1 for loop) Find the smallest and largest number in the array. Determine its position in the array. (2 for loops) How many numbers are below the average, and how many numbers are above the average. (1 for loop) Print all data to the console, but do not print the array to the console. So this is what I have so far.  import java.util.Scanner; *do I need this?* import java.util.Random; import java.util.Arrays; public class MainClass  { public static final int N = 100; public static int[] data;  public static int sum; public static int min; public static int max; public static double avg; public static void main(String[] args)  { Random rndGen= new Random(-1); *is this necessary for random gen?*         sum = 0;          int[] data = new int [N]; * do I need this even though I declared at beginning         for(int i = 0; i < N; i++) // populate array //calculate array //calculate statistics //calculate sum or array //display in data System.out.println("The Max array is " + Max); System.out.println("The Min array is " +Min); System.out.println("The sum of the array is " + Sum); System.out.println("The average of the array is " + Avg); System.out.println("The position of the smallest and largest in the array is" +location); System.out.println("There are +numbersBelow+ " below the average, and " +numbersAbove+ "above the average");

Question
  • Create an array of 100 integers using a random generator. ( 1 for loop)
  • Provide the sum and average of the array. (1 for loop)
  • Find the smallest and largest number in the array. Determine its position in the array. (2 for loops)
  • How many numbers are below the average, and how many numbers are above the average. (1 for loop)
  • Print all data to the console, but do not print the array to the console.

So this is what I have so far. 

import java.util.Scanner; *do I need this?*

import java.util.Random;

import java.util.Arrays;

public class MainClass 

{

public static final int N = 100;

public static int[] data

public static int sum;

public static int min;

public static int max;

public static double avg;

public static void main(String[] args) 

{

Random rndGen= new Random(-1); *is this necessary for random gen?*

        sum = 0; 

        int[] data = new int [N]; * do I need this even though I declared at beginning

        for(int i = 0; i < N; i++)

// populate array

//calculate array

//calculate statistics

//calculate sum or array

//display in data

System.out.println("The Max array is " + Max);

System.out.println("The Min array is " +Min);

System.out.println("The sum of the array is " + Sum);

System.out.println("The average of the array is " + Avg);

System.out.println("The position of the smallest and largest in the array is" +location);

System.out.println("There are +numbersBelow+ " below the average, and " +numbersAbove+ "above the average");

 

        

 

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Compare and contrast only two types of computer data storage approaches.

A: Comparing and contrasting two data storage approaches:

Q: Please Use JAVA to solve the problem

A: Create a java class “ArrayInv” and create a main method inside it.And declare a required variable to...

Q: Write a simplified expression for the Boolean function defined by the following Kmap.

A: Identify only 1’s in the kmap group.Find the largest group of 1’s.In three varible a group can have ...

Q: How can we check if a table has minimum redundency?A) There is no way to checkB) See if a table has ...

A: Data redundancy:File replication occurs in the database when one or more copies of file are present ...

Q: In python  Write a for loop (using the range() function) that will print the integers 10,15,20,25,30...

A: Program Instruction:Use range() function to start with 10 and end with 51 as range() function loops ...

Q: DESCRIBE THE FIRST LAYER OF BLOCK CHAIN?

A: Daniel Drescher in Blockchain Basics defines blockchain as a two-layer software system; application ...

Q: Suppose s is a string with the value "java". What will be assigned to x if you execute the following...

A: Given:String s = “java”;char x = s.charAt(4);

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Program AlgorithmStartCreate a java project named AtmSimulator and then create a class named as AtmS...

Q: (check all that apply) Which of the following is true about constraint names?A) it can be used for D...

A: A) it can be used for DBA to identify a constraint easily:Yes. Constraints are the rules that are ap...

Q: Hey i need help with coding in c++  Q1 // with steps  Write a program that determines a student’s gr...

A: Approach for the program- 1)Import the essential headers.2)Define the main function.3)Declare the va...

Q: In C++ why is a binary search function almost always more efficient than a linear search function?

A: In C++, binary search function is more efficient than linear search function because:Array must be s...

Q: PLEASE EXPLAIN ALL STEPS: This question has been answered multiple times, clearly by the same tutor,...

A: 1)xz + (xy + ~z)As there are three variables in the above Boolean expression there will be 23 = 8 ca...

Q: How often does garbage collection run on a DC? Group of answer choices 2 hours 6 hours 12 hours...

A: In this question a user must know about Garbage collection (GC) in the computer system:Garbage colle...

Q: Suppose you have two tables: EMPLOYEE and EMPLOYEE_1. The EMPLOYEE table contains the records for th...

A: To display the output of the given tables by using UNION operator.Two tables are given:First Table n...

Q: in c++ Create a new file (in Dev C++)  In Lab 2, you created a menu for a simple calculator program...

A: This C++ calculator program contains following functions:displayMessage : It prints string message o...

Q: The truth table for a Boolean expression is shown below. Write the Boolean expression in sum-of-prod...

A: Answer:Sum of Product (SOP) form:If the input is 1, then write an AND term for each input combinatio...

Q: using the web resarch Mafiaboy's exploits. when and how did he comprmise sites? How was he caught?

A: Mafiaboy was arrested by the FBI, who was surveilling him, after he claimed to have brought down the...

Q: Compare and contrast iOS and Android mobile operating systems. Which one is better?

A: Comparison of Android and iOS:

Q: Write a program that displays the income tax due on taxable income entered by the user. Have the use...

A: The program that displays the income tax due on taxable income is created in java.In calTax() method...

Q: I need help creating a trace table

A: Create a Trace Table and assign all required values according to the code. And if a variable is only...

Q: OF 2019 x + X PG Difference between two given ti https://moodle.oakland.edu/plug X fn Course: CSI-14...

A: Program in C to calculate the order price by entering number of books, price of a book, tax per book...

Q: program3_3.py in pythonWrite a wholly creative quiz program that consists of three original question...

A: The code consists of three inputs such as int, float and string for wholly creative quiz program. 

Q: Problem 3 Guessing game: For this program, have the user guess a number from 1-5. Next, generate a r...

A: Program instructions:Create a form with two fields and one submit button.User enters the number in a...

Q: A two-dimensional random walk simulates the behavior of a particle moving in a grid of points. At ea...

A: A java program that takes an integer command-line argument “n” and simulates the motion of a random ...

Q: Question 9: Consider the following: Class Course { protected: long CRN public: Course( long c ); }; ...

A: Paste all the code module after appropriate commented area.For example://write the Default construct...

Q: 1. Write a program in Python named filemaker.py that will be used to store the first name and age of...

A: This python program asks user to enter First name and Age of a number of friends. This program name ...

Q: Design a reasonably efficient algorithm for solving each of the following problems and determine its...

A: Instructions:Initialize 50 state counters Count[] to zero.Traverse the given list of n student recor...

Q: Using the types of entities found in the Colonial Adventure Tours database (trips, guides, clients, ...

A: The Set of entities provided for Colonial Adventure Tours Database includes Trips, Guides, Clients a...

Q: Python 3.7.4 Define a function called signOf that takes a parameter containing an integer value and ...

A: Function definition of "signOf()":

Q: A network topology specifies how computers, printers, and other devices are connected over a network...

A: The adjacency matrix shows the neighbor it is connected to, so for ring topology is all nodes are co...

Q: Hi, I have to display the first 20 Fibonacci numbers to the console. The first two numbers are given...

A: Program: class PrSpecial { public static final int N = 20; public static void main(String[] args){ i...

Q: Active Directory metadata describes the actual Active Directory data, not the Active Directory datab...

A: Active Directory:The Microsoft Technology used to manage computers and the other devices in a networ...

Q: Write a program in Java that prompts the user for the number of pennies, nickels, dimes and quarters...

A: A Java program is to be written that would take the values of pennies, nickels, dimes and quarters a...

Q: Brief paragraph needed: We know that the Pep/9 simulated hardware has 64K of memory. But, how is tha...

A: Pep/9 hardwareThe pep/9 hardware consists of three components that is disk, central processing unit ...

Q: Create a method multiply(), that receives the 2D array you created in the program below as as an inp...

A: Create a public static type of method with a void return type and from the main method that method w...

Q: Hello! I am new to Java and have nearly finished up a project involving a mortgage table, and everyt...

A: According to the question, students need only in output spacing.To display output in proper spacing ...

Q: Describe a cloud storage application and explain the advantages and disadvantages of such cloud stor...

A: Cloud storage:Cloud Storage is a service where data is remotely maintained, managed, and backed up. ...

Q: Shipping is free for online orders totaling $25 or more at Mississippi.com. Orders less than $25 are...

A: Note: You didn't mention any language so i use Python#get the inputs from the userunit_cost = float(...

Q: Suppose that a maximum flow network contains a node, other than the source node, without incoming ar...

A: Maximum flow problem:“Yes”, it is possible if the maximum flow network does not contain source node ...

Q: Write a C++ program: A palindrome is a word that reads the same forwards and backwards for example "...

A: Program:#include&lt;iostream&gt;#include&lt;bits/stdc++.h&gt;using namespace std;void Palindrome_Che...

Q: Why is Big O preferred than Big Theta or Big Omega when analyzing algorithms?

A: Click to see the answer

Q: Required program is java   Create a class called DuplicateRemover. Create an instance method called ...

A: Program Instructions:In class DuplicateRemover, declare a set of Strings and create methods remove()...

Q: Python 3.7.4 Store four file objects corresponding to the files winter2003.txt , spring2003.txt, sum...

A: Python statements for creating file objects: winter=open("winter2003.txt", "r")spring=open("spring20...

Q: This is the question: Suppose that we want to synthesize a circuit that has two switches x and y. Th...

A: Here in this synthesize circuit NOT AND and OR gate is used. So let us try to understand the figure ...

Q: Suppose you have two columns, [Text1] and [Text2], in a MS Access table, how do you enforcethat only...

A: Validation rule to have value in one column:[Text1] and [Text2] are the two columns in a MS access t...

Q: Add each element in origList with the corresponding value in offsetAmount. Print each sum followed b...

A: Completing the given C++ program so, that it can follow the given rubrics:Two vector, origList and o...

Q: Write a program in Java Eclipse that does the following:a) create a 2D Ragged array with columns and...

A: Create a Main class and all required methods to print Ragged array elements. And create all methods ...

Q: Describe the activities that occur during project development.

A: Project development is a process in which resources are planned, organized and coordinated to achiev...

Q: What issues and problems are raised by the use ofunintegrated information systems?

A: Loss and failures associated with computers are major computer issues, leading to unnecessarily high...