Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Background In this lab, we will compute the following statistical measures for randomly generated numbers. The mean of a set of numbers is the sum

image text in transcribed
Background In this lab, we will compute the following statistical measures for randomly generated numbers. The mean of a set of numbers is the sum of all values divided by the number of values. The median of a sorted set of numbers is the middle value of that set. For example, given the array {1,4,9,5, 22 ), the median is the element 9 in index 2 (remember that we start counting from 0!). Requirements Read over these requirements and answer the questions below before you begin writing your program. Create the following fields in the Statistics class. private int[] dataset Create the following methods in the Statistic dass. A l-arg constructor that takes an integer argument called Length and initializes the dataset field. Then randomizes the array using the following method. private void randomize) randomizes each of the elements in the array with an integer between 0 and 1000 and then sorts them. public double mean(Computes and returns the mean of the data set. . public int median Returns the middle element in the sorted data set. public int min) Returns the smallest element in the array. public int max() Returns the largest element in the data set. public void print Prints all of the elements in the array on a single line. The driver class should ask the user for a single natural number between 5 and 50. Note that you will need to store this value in an int variable. Then print out the data as seen in the example below. Don't worry about matching the spacing or decimal places seen in the results. Enter an array size between 5 and 50: 99 Enter an array size between 5 and 50: Enter an array size between 5 and 50: Mean value: 413.9 Median value: 405 Minimum value: 60 Maximum value: 60, 295, 339, 405, 567, 568, 663, 663

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

What lessons in OD contracting does this case represent?

Answered: 1 week ago

Question

Does the code suggest how long data is kept and who has access?

Answered: 1 week ago