# Table 5 Exercises

Each of the following problems asks you to count two things. The last two lines printed should look like:

```count: 23
count: 42
```

For simplicity, we will just use the word "count" for both lines in the output. The starter code includes lines to set variables `count1` and `count2` to zero before the loop. As usual, you can print and count some cases by hand to check your code before submit time.

1. Do more baby names start with "A" or "B"? Write code to count and print those two counts ("A" count, then "B" count).

 table = new SimpleTable("baby-2010.csv"); count1 = 0; count2 = 0; for (row: table) { // your code here }

2. Now we'll look at the survey data. How many people identified "red" or "blue" as their favorite color? The appropriate field in the survey is "color". Write code to count and print those two cases ("red" count, then "blue" count).

 table = new SimpleTable("survey-2012.csv"); table.convertToLowerCase(); count1 = 0; count2 = 0; for (row: table) { // your code here }

3. Instead of looking at the whole survey, let's look only at the people who identified "coke" as their favorite soda (not "diet coke", just "coke"). How many of them ("coke" rows) identified "red" or "blue" as their favorite color? The appropriate fields in the survey are "soda" and "color". Write code to count and print those two cases ("red" count, then "blue" count), among the coke drinkers.

 table = new SimpleTable("survey-2012.csv"); table.convertToLowerCase(); count1 = 0; count2 = 0; for (row: table) { // your code here }