Hi, I am required to: 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. I need details how this is coded step by step in java. I already started on the code and I have: public class Project_7 {public static void main(String[] args) {Random randomNum = new Random();double[] arrayNum = new double[100];for(int i=0;i<arrayNum.length; i++){arrayNum[i]=Math.random()*100;System.out.println(arrayNum[i]);}int sum = 0;for(int i=0; i<arrayNum.length; i++);{sum += arrayNum[i];System.out.println("Sum is" + sum );}double average = sum/100;   Its not perfect but its a start. Please include details for each step so I can understand. Thank you!

Question

Hi, I am required to:

  • 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.

I need details how this is coded step by step in java.

I already started on the code and I have:

public class Project_7
{
public static void main(String[] args)
{

Random randomNum = new Random();
double[] arrayNum = new double[100];

for(int i=0;i<arrayNum.length; i++)
{
arrayNum[i]=Math.random()*100;
System.out.println(arrayNum[i]);
}

int sum = 0;
for(int i=0; i<arrayNum.length; i++);
{
sum += arrayNum[i];
System.out.println("Sum is" + sum );
}

double average = sum/100;

 

Its not perfect but its a start. Please include details for each step so I can understand. Thank you!

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

Java

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: whats is the length of UDP?

A: The given User Datagram Protocol header is 12 03 00 0F 00 1E A3 10.The UDP (User Datagram Protocol) ...

Q: Please explain how you solve the follwing problem:

A: a) CHAIN set for each variable:CHAIN(S) = {B, C, A}CHAIN(A) = {A}CHAIN(B) = {B}CHAIN(C) = {C, A}

Q: write code in c++ to calculate f(0.006), wheref(x) = e−x − cos xln(x + 1)correctly to ten decimal pl...

A: Create a C++ program and include all required modules.Define a macro "e" with value 2.71828.Create a...

Q: Use the Design Recipe to write a function weighted_total(number_list,weights) that consumes a list o...

A: The given list of numbers is [1, 2, 3].The given weights are [0.1, 0.5, 0.4].weighted_total(number_l...

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: consider the sender A transmits 12 data packets to b using stop wait protocol. if every 3rd packet i...

A: The all data transmission in send and wait protocol as follows:If packet loss, retransmit packet.Ini...

Q: program7_2.pyThis Pthon program requires two functions. In the main function: create an empty list....

A: To write a program in python, that accepts the twelve random integers in a list, each in the range 1...

Q: How would you modify the dynamic programming algorithm for the coin collecting problem if some cells...

A: Coin collecting problemIn a n-m board, several coins are placed in such a way no more than one coin ...

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

A: A Java program that satisfies the given criteria is given below,Program://Import necessary packagesi...

Q: MIPS assembly language please help    Write a program for a grocery store to calculate the total cha...

A: Some definitions required to know before doing this program: -1.What is Mars?2.What is MIPS?3.What i...

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: Consider the following information about a university database: Professors have an SSN, a name, an ...

A: Below is the ER Diagram based on the information given in the question about the university.

Q: Identify, list, and define the six components of an information system.

A: Information System (IS):Information system is the system that deals with the organisation, storage, ...

Q: Draw the truth tables for the following Boolean expressions. xy+yz+xz x¯y+yz¯+x¯z (x⊕y)+(y⊕z)+(x...

A: Hello. Since you have posted multiple questions and not specified which question needs to be solved,...

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: 3) Write friend function for the following class to overload the &lt;&lt; and &gt;&gt; operators. Th...

A: Create a class called Math.Declare the prototype of the input friend function with input stream(istr...

Q: Boolean Logic Draw the truth table for the following functions: F(A,B)=AB+(A+B) F(A,B,C)=AB+BC+...

A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...

Q: The class RoachPopulation simulates the growth of a roach population.The constructor takes the size ...

A: Program code #1:

Q: PLEASE EXPLAIN ALL STEPSUsing the boolean equation (x + ~xy) XOR ~xz Create a circuit diagram Creat...

A: We’ll answer the first three subparts of the question since the exact one wasn’t specified. Please s...

Q: You will write 4 classes for Program 5.  Assignment:The BankAccount class models an account of a cus...

A: Java Program:Filename :- BankAccount.java// Import the required packageimport java.util.Date;// Clas...

Q: Using the data file capabilities of C++, create a Personnel file, personnel.dat on your drive and th...

A: Program Instructions:Use do-while loop to repeatedly present the menu.Use switch statement to opt di...

Q: Write a program that takes the x, y coordinates of a point in the Cartesian plane and prints amessag...

A: Note: You didn't mention any languages so i use C language//include the header file#include&lt;stdio...

Q: Odd man out: . Topological sort Algorithm DFS Algorithm Binary search Algorithm BFS Algorithm Prim's...

A: Answer:Binary Search AlgorithmExplanation:Topological sort Algorithm, DFS algorithm, BFS algorithm a...

Q: in python   Write a program that prompts the user for three keyboard inputs and stores them in appro...

A: Following is the python program which takes three inputs from the user i.e. first name, last name an...

Q: Vectors Write three statements to print the first three elements of vector runTimes. Follow each wit...

A: Program DescriptionThe program prompts the user to input 5 numbers to populate the vectorIt tests th...

Q: Write a program TwoSmallest.java that takes a set of double command-line arguments and prints the sm...

A: Create a class and main method and in the main method declare all required variables to find the fir...

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: This program is written in pseudocode."Design a program that asks the user to enter a store's sales ...

A: Create a C++ program and in the "main" method define an array with name "item" and define a macro wi...

Q: what are the mantissa and exponent values if 6.75 is represented in 8-bit binary floating point repr...

A: Conversion of decimal to 8-bit floating point representation:Step 1: Convert the integer part of the...

Q: Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every yea...

A: In order to correct given program, make the following changes:Put def main() code above the def leap...

Q: X-Kingdom has trapped n number of soldiers of their opponent. They want to execute them. They create...

A: C Program:// Include the header files#include&lt;stdio.h&gt;#include&lt;stdlib.h&gt;// Declare and i...

Q: Assign secretID with firstName, a space, and lastName. Ex: If firstName is Barry and lastName is All...

A: To correct the given program code to assign the secretID as firstName,  space, and lastName, as show...

Q: I have to code the game mastermind, but i only got halfway. I got the user input, 8 colors and the 3...

A:  solving the duplication problem:Create a temporary array named "temp" and initiate that array with ...

Q: Write the code to assign the value 10 to an variable named a

A: The Java code is given below to assign the value 10 to a variable named ‘a’. There are two ways to a...

Q: Preffered language is java. Will be compiled with intellij. Need a solution for each part 1-5. Is it...

A: This program asks the user a question and tells whether the answer is correct or not. Keeps asking t...

Q: Question 2: Which statement(s) is/are true about vectors? a) A vector's size is static. b) A vector'...

A: VectorsA vector is an object that has both magnitude and direction. It is a directed line segment wh...

Q: For the (pseudo) assembly code below, replace X, Y, P, and Q with thesmallest set of instructions to...

A: Consider the procedure procA, which is the caller in the given example.proceA storing some results $...

Q: What folder contains group policy templates, logon/logoff scripts, and DFS synchronization data? Gro...

A: “System Volume (SYSVOL)” folder contains group policy templates, logon scripts, and Distributed File...

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: Research and describe one interesting application of data or text mining.

A: Data miningData mining is the process of discovering patterns of data in large data sets using metho...

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

A: Program InstructionsFirst, click on the file and create a new project called “PatternMaker”.Then, cr...

Q: in python Write a program that creates a list of your friends. Start with an empty list and then us...

A: List:  A list in python is a data structure which stores data or items of various data types. A list...

Q: I dont understand whats going on Its hard for me to read whats happening and what the output will be...

A: Click to see the answer

Q: In C++ I need to compose a function that accepts an array of integer values as an argument and retur...

A: Program Instructions:Pass array to the function getSum().Use the reference of the array to get the s...

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

A: Create a Java class MultiTable which uses 2 for-loops to create multiplication table.Outer for-loop ...

Q: PLEASE EXPLAIN ALL STEPSIn the following code, determine the value of the symbole this. Predict and ...

A: Explanation of given code:“this” is a variable.DECO this, d; The instruction DECO means Decimal outp...

Q: Create a complete ERD in Crow’s Foot notation that can be implemented in the relational model using ...

A: In the crow’s foot notation, entities are displayed in a box with the attributes listed below the na...

Q: Find the truth table that describes the following circuit.

A: The diagram shown below is taken from the given question- 

Q: Write a program (or modify the one written for Lab 2) that displays the following menu and prompts t...

A: Create a main method and declare all required variables (two variables for operations (+, -, *, /) a...

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

A: AlgorithmLet x be one of the numbers and the other number is n-x. The first step is to maximize f(x)...