Hi there,
I have this long Q
and I must solve it to get bouns or i will fail :(

Develop a statistical program to compute the famous statistics. First, create a text file, data.txt, contains several observations. Then write a java program that displays the following menu:

``````Main Menu
---------------------------------
1.  Mode
2.  Median
3.  Range
4.  Stem and Leaf Plot
5.  Histogram
6.  Exit
---------------------------------
``````

The needed operation is executed based on the user choice so that the user cannot leave the program unless he chooses 6 (Exit).
The data read from file should be stored in 1-D array named dataArray. In the program, each item in the above main menu is executed through a method called from the main. Besides these methods, you need to add the following static methods:
- Search method which takes 1-D array (List) and an element (key). It returns true if key is found in List.
- Sort method which takes 1-D array (List) it returns 1-D array (sorted increasingly)
- findMax which takes 1-D array (List) it returns the maximum value in List
- findMin which takes 1-D array (List) it returns the minimum value in List
The program should send the dataArray as a parameter to the required methods based on the user choice. The method returns the appropriate value to the main. The real numbers should appear in this format .3f (3 digits after the decimal point).
The methods depend on the definition of the above statistical terminology:
Mode is the most frequent observation in a data set.
Range: the difference between the highest and the lowest values in a set.
Median is the observation that lies on the middle. To find the median, arrange the data increasing order, then calculate the following:

``````                  Xn+1/2   n is odd
Median = {(Xn/2 + Xn/2+1)/2
``````

The above additional methods (search, sort, and findMax/findMin) are used to find the statistics (mode, median, and range respectively) i.e. the method should be called from the statistic method e.g. search method should be called from the mode method, sort from the median method and so on. Therefore max. number of static method is 10 Stem and Leaf Plot and Histogram items in the main menu are described with the following example:
Assume the observations on the data.txt are:

``````1.17    1.61    1.16    1.38    3.53    1.23    3.76    1.94    0.96    4.75    0.15
2.14    0.71    0.02    1.59    0.19    0.82    0.47    2.16    2.01    0.92    0.75
2.59    3.07    1.40

Stem and Leaf Plot
Stem                Leaf    Frequency
0   02 15 19 47 71 75 82 92 96      9
1   16 17 23 38 40 59 61 94         8
2   01 16 41 59                 4
3   07 53 76                3
4   75                  1
Total                       25
``````

That means the method of stem and leaf plot should return a 2-D array as in the example above sample while that of the histogram should not return any value since it only draws the histogram i.e. nothing more than drawing.

I apprecaite any one give me help

Edited by mike_2000_17: Fixed formatting

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by NormR1

You haven't asked a question. Copying and pasting the assignment is not the same.

From the forum rules:
Do provide evidence of having done some work yourself if posting questions from schoolwork assignments.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.