519
walk does not count as either a hit or an at-bat when the batting average is be-
ing calculated.
Design and implement an application that prints a table showing each
player’s identification number, batting average, and number of walks. (Be care-
ful: The players’ identification numbers are 1 through 20, but Java array indexes
start at 0.)
2.Design, implement, and test a class that calculates the mean and standard de-
viation of integers stored in a file. The output should be of type floatand
should be properly labeled. The formula for calculating the mean of a series of
integers is to add all the numbers, then divide by the number of integers.
Expressed in mathematical terms, the mean Xof Nnumbers X 1 ,X 2 , ...XNis
To calculate the standard deviation of a series of integers, subtract the mean
from each integer (you may get a negative number) and square the result, add
the squared differences, divide by the number of integers minus 1, then take
the square root of the result. Expressed in mathematical terms, the standard
deviation Sis
The methods of the class that access the input data should take a file as a
parameter.
3.A local bank is gearing up for a big advertising campaign and would like to see
how long its customers are waiting for service at its drive-up windows. Several
employees have been asked to keep accurate records for the 24-hour drive-up
service. The collected information, which is read from a file, consists of the
time the customer arrived in hours, minutes, and seconds; the time the
customer actually was served; and the teller’s ID number. Design and
implement a class with the following responsibilities:
a.Reads in the wait data.
b.Computes the wait time in seconds.
c. Calculates the mean, standard deviation (defined in Programming Problem
2), and range.
d.Prints a single-page summary showing the values calculated in part (c).
S
XX
N
i
i
N
=
( − )
−
=
∑
2
1
1
X
X
N
i
i
N
= =
∑
1