Foreword
Resources
Code Listings
Foil Sets
Assignments
Solutions
External Resources
SiteMap
Search
Home
| |
[ Up ] [ Assignment-01a ] [ Assignment-01b ] [ Assignment-01c ] [ Assignment-01d ] [ Assignment-02 ] [ Assignment-02a ] [ Assignment-03 ] [ Assignment-03a ] [ Assignment-03b ] [ Assignment-03c ] [ Assignment-03d ] [ Assignment-04 ] [ Assignment-04a ] [ Assignment-04b ] [ Assignment-05 ] [ Assignment-06 ] [ Assignment-07 ]
Writing a Java application
For ideas how to solve this problem, study the programs in directory Java/examples-appl/,
especially the applications SumArray.java
and Average.java
- Write a Java application (not an applet) that computes the mean and standard
deviation of the following array of data:
double[] x = { 148.00, 125.25, 88.50, 133.25, 95.00,
104.50, 135.00, 108.25, 122.50, 107.25,
137.00, 114.00, 124.50, 118.00, 119.00,
117.25, 93.25, 115.00, 116.50, 99.50,
106.00, 103.75, 115.25, 128.50, 105.00 };
Output the following lines on standard output: The mean is XXX.XX
The standard deviation is XX.XX
Call the mean "mu" and the standard deviation
"sd". Use the following formulas: where n is
the length of the array x .
Compute n using the length attribute of the array x .
Put a link to your Java source file on your CSC 499 homework page.
Extra Credit: Compute the range of the data, that is, the
minimum and the maximum values of x .
|