|
|
|
|
|
|
|
Testing: This program was run with the data listed below. (We list the data in three columns to save space.) The names of the candidates entered from the keyboard were Smith, Jones, Adams, and Smiley. In this data set, there is at least one vote for each candidate in each precinct. Case Study Follow-Up Exercise 1 asks you to outline a complete testing strategy for this program. |
|
|
|
|
|
|
|
|
1 1 3 1 3 3
1 1 4 3 4 4
1 2 3 4 4 4
1 2 3 2 4 3
1 3 3 3 4 4
1 4 2 1 4 4
2 2 2 3 4 1
2 2 4 3 4 2
2 3 4 4 2 4
2 1 3 2 4 4 |
|
|
|
|
|
|
|
|
The output, which was written to file reportFile, is shown below. |
|
|
|
|
|
|
|
|
Jones Smith Adams Smiley
Precinct 1 2 2 1 1
Precinct 2 2 2 2 1
Precinct 3 1 2 2 1
Precinct 4 1 1 3 6
Total votes for Jones: 6
Total votes for Smith: 7
Total votes for Adams: 8
Total votes for Smiley: 9
Total votes for precinct 1: 6
Total votes for precinct 2: 7
Total votes for precinct 3: 6
Total votes for precinct 4: 11 |
|
|
|
|
|