< previous page page_643 next page >

Page 643
Your program should output each client's code and name, but no duplicates should be printed.
3. Write a program that calculates the mean and standard deviation of integers stored in a file. The output should be of type float and should be properly labeled and formatted to two decimal places. 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 X of N numbers X1, X2, ... XN is
0643-01.gif
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 all these squared differences, divide by the number of integers minus one, then take the square root of the result. Expressed in mathematical terms, the standard deviation S is
0643-02.gif
4. One of the local banks is gearing up for a big advertising campaign and would like to see how long its customers are waiting for service at 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 when the customer arrived in hours, minutes, and seconds; the time when the customer actually was served; and the ID number of the teller. Write a program that does the following:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. Reads in the wait data.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. Computes the wait time in seconds.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. Calculates the mean, standard deviation (defined in Programming Problem 3), and range.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
d. Prints a single-page summary showing the values calculated in part c.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Input:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The first data line contains a title.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The remaining lines each contain a teller ID, an arrival time, and a service time.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The times are broken up into integer hours, minutes, and seconds according to a 24-hour clock.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Processing:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Calculate the mean and the standard deviation.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Locate the shortest wait time and the longest wait time for any number of records up to 100.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Output:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The input data (echo print).
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The title.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The following values, all properly labeled: number of records, mean, standard deviation, and range (minimum and maximum).

 
< previous page page_643 next page >