# Table 5 Exercises

Each of the following problems asks you to count two things. The last 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 } table-5-ex1

## 2.

Now we'll look at the survey data. How many people identified "Modern Family" vs. "Game of Thrones" as their favorite TV show? The appropriate field in the survey is "tv". Write code to count and print those two values ("Modern Family" count, then "Game of Thrones" count).

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

## 3.

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

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

This button will retrieve the code that has been run/saved from this page. Generally you retrieve your code all at once from a "homework" page, but this button is an alternative to retrieve your code for a particular exercise.

count 3 : table-5-ex1 table-5-ex2 table-5-ex3

```(code appears here)

```