< previous page page_706 next page >

Page 706
5. The local bank in Programming Problem 4, Chapter 11, was so successful with its advertising campaign that the parent bank decided to collect data on waiting times from banks all over the state and run a contest. However, this time they decided to assign frustration levels to wait times as follows:
Wait Time
Frustration Level
wait<(mean-standardDev)
"Amazed"
(mean-standardDev)<wait<mean
"Pleased"
mean<wait<(mean + standardDev)
"Calm"
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
(mean + standardDev)<wait<(mean+2*standardDev)
"Irritated"
(mean+2*standardDev)<wait
"Berserk"

where mean is the mean waiting time, wait is the wait time, and standardDev is the standard deviation of the waiting times. Calculate frustration levels for each recorded wait.
Input:
Same as in Programming Problem 4, Chapter 11, except that two digits have been added to the teller ID number to indicate at which bank the teller is located.
Output:
Same as for Programming Problem 4, Chapter 11, plus 1) a bar graph (histogram) showing frustration level distribution; and 2) a table sorted by three-digit ID numbers showing (a) ID number, (b) wait time, and (c) frustration level.
6. Complete the driver program described in the Testing and Debugging section. Use it to test the functions Search, Search2, SearchOrd and BinSearch thoroughly. Choose your test data carefully, making sure that all cases are tested.
Case Study Follow-Up
1. In the Birthday Reminder Revisited case study, the GetMonth function declares and initializes two local arrays, monthAry and strMonthAry. These are automatic variables, so they are created and initialized every time the function is called, and they are destroyed each time the function returns. Improve the function by ensuring that the arrays are created and initialized only once and remain "alive" for the duration of the entire program. (Hint: Review the description in Chapter 8 of lifetimes of variables.)
2. The Exam Attendance case study uses an insertion sort, placing each student's name into its proper place in the list as it is input. Rewrite the program to input all the names at once and then sort them using selSort.
3. The Exam Attendance case study uses a binary search to search the student list. Assuming a list of 200 students, how many loop iterations are required to determine that a student is absent? How many iterations would be required if we had used the Search function instead of BinSearch?

 
< previous page page_706 next page >