Java Reference
In-Depth Information
Enter an integer:
The bits are 1111111111111011
-5
( Hint : You need to use the bitwise right shift operator ( >> ) and the bitwise AND
operator ( & ), which are covered in Appendix G, Bitwise Operations.)
**4.47
( Statistics: compute mean and standard deviation ) In business applications, you
are often asked to compute the mean and standard deviation of data. The mean is
simply the average of the numbers. The standard deviation is a statistic that tells
you how tightly all the various data are clustered around the mean in a set of data.
For example, what is the average age of the students in a class? How close are the
ages? If all the students are the same age, the deviation is 0.
Write a program that prompts the user to enter ten numbers, and displays the mean
and standard deviations of these numbers using the following formula:
n
2
¢ a
x i
n
n
i
=
1
x i 2
x i
-
a
a
x 1 +
x 2 +
. . .
+
x n
n
i = 1
i = 1
mean
=
=
deviation
=
c
n
n
n
-
1
Here is a sample run:
Enter ten numbers:
The mean is 5.61
The standard deviation is 2.99794
1 2 3 4.5 5.6 6 7 8 9 10
 
Search WWH ::




Custom Search