|
|
|
|
|
|
|
Testing: The program was executed with the following test data, which include at least one zero in each row and column. Case Study Follow-Up Exercise 2 asks you to outline a complete testing strategy for this program. |
|
|
|
|
|
|
|
|
File dataFile 0 6 3 3 4 1
1 0 1 3 0 3
1 1 0 2 1 1
1 0 1 0 0 1
2 3 4 2 1 0 |
|
|
|
|
|
|
|
|
Listed below are the results written to file reportFile. |
|
|
|
|
|
|
|
|
ABSENTEE DATA
Monday Tuesday Wednesday Thursday Friday
Value % Value % Value % Value % Value %
Dept A 0 -100 1 0 1 0 1 0 2 100
Dept B 6 200 0 -100 1 -50 0 -100 3 50
Dept C 3 67 1 -44 0 -100 1 -44 4 122
Dept D 3 50 3 50 2 0 0 -100 2 0
Dept E 4 233 0 -100 1 -17 0 -100 1 -17
Dept F 1 -17 3 150 1 -17 1 -17 0 -100
BAR CHART: ABSENCES BY DAY
Monday Tuesday Wednesday Thursday Friday
100%
90%
80%
70%
60%
50%
40% *
30% * *
20% * * *
10% * * * * * |
|
|
|
|
|
|
|
|
Something looks a little strange: the percentages in the bar chart add up to 110 percent. Remember that in Chapter 10 we mentioned that strange things can happen with floating point numbers. In the Absentee program, each percentage figure is changed to an integer for use as an index. To do so, the percentages are rounded to the nearest 10 percent. When we noticed that the percentages added up to 110 percent, we put a debugging output statement in the program to monitor what was happening. The percentages and rounded values are shown below. |
|
|
|
|
|