# Solved Homework: Question: Itle: HW0S:Random number and array Date Assigned: 10/24 00.20 Due Date:10/27 23:59 Max Points: 10…

itle: HW0S:Random number and array Date Assigned: 10/24 00.20 Due Date:10/27 23:59 Max Points: 10 Write a java program named RandomNumberArray.java that accepts 3 numbers, N, L, and U from the Cmd arqument list. Use these three numbers to perform the following tasks: 1. The first number N specifies the number of int array in your program, create an int array with the size ofN 2. Generate random numbers betveen L and U and assign the random numbers to each of the element in the array you defined in step 1 3. Calculate the average of the array elements 4 Count hou many array elements are below the average, above average, and equal to average s. Display results in the tormat as shown below: Average-50 20 elements are below the average 28 elements are above the average 2 elements are equal to the average xtended to 11/10 23159 pproved on 11/07 13:33 MacBook Pro 5 6 8 0

Java Program:

import java.util.Random;

public class Main

{

public static void main(String[] args)

{

int N, L, U;

N = Integer.parseInt(args[0]);

L = Integer.parseInt(args[1]);

U = Integer.parseInt(args[2]);

int arr[] = new int[N];

Random rand = new Random();

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

arr[i] = rand.nextInt(U-L) + L;

double sum = 0;

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

sum += arr[i];

double avg = sum/N;

int below, above, equal;

below = above = equal = 0;

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

if(arr[i] == avg)

equal++;

else if(arr[i] > avg)

above++;

else

below++;

System.out.println(“Average = ” + avg);

System.out.printf(“%2d elements are below the averagen”, below);

System.out.printf(“%2d elements are above the averagen”, above);

System.out.printf(“%2d elements are equal to the averagen”, equal);

}

}

Instructions:

Save the Program as Main.java

Run it as Main 20 40 80

Change the arguments as you want

OUTPUT:

Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

Try it now!

## Calculate the price of your order

Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.