Create Java class Stats in a file Stats.java .
There will be two parts to the program that the user can see: (1) enter the data, and (2) ask for various summary data.
The data will be entered one value per line. The values should be stored with the double type. There will be at most 1000 values entered; you program shouldn't accept more than 1000 values. The user will enter -1000 to indicate the end of the input. (The -1000 isn't part of the data set.)
Once the data has been entered, the user should be given a menu with four choices:
- Mean
- Variance and Standard Deviation
- Histogram
- Exit
The first three choices should display the corresponding summary data. The last should quit the program.
Histogram Format
The range of the histogram will be between the smallest and largest value in the data set. There will be 10 bars displayed, each with an equal part of the range. For example, if the smallest value is 0.0 and the largest is 10.0, the bars will represent the ranges [0.0, 1.0], (1.0, 2.0], (2.0, 3.0], ... , (9.0, 10.0].
The bars will be displayed horizontally, with the first bar (eg. 0.0 - 1.0) at the top, and the last (eg. 9.0 - 10.0) at the bottom. Each data value in the range will be represented by a *. For example, the histogram might look like this:
**
*********
********************
************************************
*****************************************
****************************************
**********************
*****************
*********
***
If the ranges are the same as the example above, there are two values in the range [0.0, 1.0], nine in the range (1.0, 2.0], and so on.