1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
il63 [147K]
3 years ago
9

Create an array of numbers filled by the random number generator. (value = (int)(Math.random() * 100 + 1);) Print the array and

determine the smallest, largest, average, and calculate the standard deviation. Allow the client to pick the size of the array to be used and allow the client to repeat the process with a new array. Use a method to calculate the standard deviation. In statistics and probability theory, the standard deviation shows how much variation or dispersion from the average exists in a group of numbers. A low standard deviation indicates that the data points tend to be very close to the mean (also called expected value); a high standard deviation indicates that the data points are spread out over a large range of values. For a finite set of numbers, the standard deviation is found by taking the square root of the average of the squared differences of the values from their average value. For example, consider a population consisting of the following eight values: 2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0. These 8 data points have the mean (average) of 5.0. (2.0 + 4.0 + 4.0 + 4.0 + 5.0 + 5.0 + 7.0 + 9.0)/8.0 = 5.0.
Calculate the difference of each data point from the mean (average) and square this value.
Computers and Technology
1 answer:
Y_Kistochka [10]3 years ago
4 0

Answer:

Explanation:

the following is the code to run this (JAVA)

MeanStandardDev.java

import java.util.Random;

import java.util.Scanner;

public class MeanStandardDev {

public static void main(String[] args) {

// Declaring variables

int N;

double lower, upper, min, max, mean, stdDev;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

// Getting the input entered by the user

System.out.print(" How many Random Numbers you want to generate :");

N = sc.nextInt();

System.out.print("Enter the Lower Limit in the Range :");

lower = sc.nextDouble();

System.out.print("Enter the Upper Limit in the Range :");

upper = sc.nextDouble();

// Creating Random class object

Random rand = new Random();

double nos[] = new double[N];

// this loop generates and populates 10 random numbers into an array

for (int i = 0; i < nos.length; i++) {

nos[i] = lower + (upper - lower) * rand.nextDouble();

}

//calling the methods

min = findMinimum(nos);

max = findMaximum(nos);

mean = calMean(nos);

stdDev = calStandardDev(nos, mean);

//Displaying the output

System.out.printf("The Minimum Number is :%.1f\n",min);

System.out.printf("The Maximum Number is :%.1f\n",max);

System.out.printf("The Mean is :%.2f\n",mean);

System.out.printf("The Standard Deviation is :%.2f\n",stdDev);

}

//This method will calculate the standard deviation

private static double calStandardDev(double[] nos, double mean) {

//Declaring local variables

double standard_deviation=0.0,variance=0.0,sum_of_squares=0.0;

/* This loop Calculating the sum of

* square of eeach element in the array

*/

for(int i=0;i<nos.length;i++)

{

/* Calculating the sum of square of

* each element in the array    

*/

sum_of_squares+=Math.pow((nos[i]-mean),2);

}

//calculating the variance of an array

variance=((double)sum_of_squares/(nos.length-1));

//calculating the standard deviation of an array

standard_deviation=Math.sqrt(variance);

return standard_deviation;

}

//This method will calculate the mean

private static double calMean(double[] nos) {

double mean = 0.0, tot = 0.0;

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Calculating the sum of all the elements in the array

tot += nos[i];

}

mean = tot / nos.length;

return mean;

}

//This method will find the Minimum element in the array

private static double findMinimum(double[] nos) {

double min = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] < min)

min = nos[i];

}

return min;

}

//This method will find the Maximum element in the array

private static double findMaximum(double[] nos) {

double max = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] > max)

max = nos[i];

}

return max;

}

}

the OUTPUT should give;

How many Random Numbers you want to generate :10

Enter the Lower Limit in the Range :1.0

Enter the Upper Limit in the Range :10.0

The Minimum Number is :1.1

The Maximum Number is :9.9

The Mean is :6.30

The Standard Deviation is :2.98

cheers i hope this helps!!!

You might be interested in
Identify the type of error described
Arturiano [62]

Answer:

ZeroDivisionError

ValueError

Explanation:

ZeroDivisionError occurs when you attempt to divide a number by 0.

ValueError occurs when the argument passed into a function holds the wrong value. In this case, the string is not numeric which cannot be passed into the float() function.

Hope this helps :)

5 0
3 years ago
From the start screen you can
sergey [27]
Shut down, restart, sign out, lock computer, sleep, open programs
8 0
3 years ago
Read 2 more answers
What does enterprise operating system mean?
Alla [95]
It means the operating system used in enterprise.
When a corporation needs 100 computers to have OS, it has to order enterprise OS packages from M$.
7 0
4 years ago
Directions: Fill in the blanks with the appropriate word in each statement below.
mart [117]

Answer:

sbysgscd CD CD vdhdudiididjehgegeueuheve gf hdgowincobwbciehidgwdgiwigwdigxifqugwljvwvwxi2dvwvwxixwvwxvqvwivqi

xwv2digwxivwiw

wxvixbowowxowcohwco2ch2od

odhowhowcowcohwxohwdowdjeciwr

hiwdodwobwdvqoo230ie

9qhowwdhwdigwdoieexohxiefbeoc

hwdhefgdegedogex

Explanation:

9hwx9hex9hexobeb8xgx9jcr

jd2oh2ih2xi2dd2oxivqsg8xwohjgwxohdeohwxihwdoeciwxgiweiguofyoe5u5ew46w57lrroyvyreiyfe1ei2ei2idxwdooydyofpiwigpwxwduo1zuo1dif3o4y

2hupv2rxou2xu2du2d

ou1svxiexuowvouqdip2dpwcuowd2u

qxigqedouovqudipgqipwgipcwpi2di2ipegpi2efpi2dipe2ip1dgxip2ce1piecg1peix1ou2co2dpu1ecgip1eip1deg1euouoeupdeuofour68ditsoysrs27ro457uoeigpexupgeip3dpiwdguof<em>o</em><em>y</em><em>i</em><em>y</em><em>y</em><em>i</em><em>d</em><em>i</em><em>y</em><em>u</em><em>f</em><em>u</em><em>o</em><em>u</em><em>o</em><em>d</em><em>y</em><em>i</em><em>d</em><em>y</em><em>o</em><em>u</em><em>o</em><em><u>o</u></em><em><u>u</u></em><em><u>u</u></em><em><u>p</u></em><em><u>w</u></em><em><u>d</u></em><em><u>9</u></em><em><u>d</u></em><em><u>e</u></em><em><u>d</u></em><em><u>i</u></em><em><u>w</u></em><em><u>g</u></em><em><u>i</u></em><em><u>p</u></em><em><u>2</u></em><em><u>s</u></em><em><u>o</u></em><em><u>u</u></em><em><u>2</u></em><em><u>s</u></em><em><u>g</u></em><em><u>9</u></em><em><u>2</u></em><em><u>3</u></em><em><u>u</u></em><em><u>g</u></em><em><u>o</u></em><em><u>1</u></em><em><u>3</u></em><em><u>u</u></em><em><u>e</u></em><em><u>f</u></em><em>c</em><em>i</em><em>d</em><em>y</em><em>i</em><em>d</em><em>5</em><em>7</em><em>g</em><em>d</em><em>q</em><em>i</em><em>g</em><em>e</em><em>o</em><em>b</em><em>x</em><em>r</em><em>i</em><em>1</em><em>e</em><em>i</em><em>y</em><em>f</em><em>2</em><em>i</em><em>p</em><em>e</em><em>c</em><em>h</em><em>k</em><em>c</em><em>y</em><em>i</em><em>d</em><em>o</em><em>u</em><em>x</em><em>t</em><em>u</em><em>x</em><em>u</em><em>o</em><em>c</em><em>z</em><em>i</em><em>y</em><em>c</em><em>y</em><em>i</em><em>y</em><em>y</em><em>i</em><em>y</em><em>i</em><em>y</em><em>2</em><em>i</em><em>d</em><em>y</em><em>i</em><em>g</em><em>x</em><em>y</em><em>i</em><em>y</em><em>i</em>yiydiyyiiyciyc2ouvyidyiyidydyidiyf7uo2vu1e

8 0
3 years ago
Guess the output of this code:<br>print( (3**2)//2)​
tigry1 [53]

Answer:

hope it helps dear, please let me know! what is the question exactly....in words?good luck

4 0
3 years ago
Other questions:
  • Programmers often author which type of information to guide test runs?
    10·1 answer
  • What are all the folders located on the DOCK called?
    11·1 answer
  • What acronym describes networked devices that contain microcomputers but are not thought of as computing devices, such as refrig
    9·1 answer
  • Microsoft word 2016
    14·1 answer
  • Which of the following is NOT something you can specify in the bullets and numbering dialog box?
    8·1 answer
  • Simon is producing a report on major rivers in North America. In the report he wants to add a table that displays the statistics
    12·1 answer
  • Write a recursive function is_pow2(n) that returns True if the positive integer n is an integer power of 2, and False otherwise.
    9·1 answer
  • Where can you get information on receiving financial help?
    12·1 answer
  • 14. My computer “boots-up” (aka activates and starts running) but it tells me that it cannot find the data to start the operatin
    6·1 answer
  • What report indicates where users start or exit the conversion funnel?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!