Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write code to print the row for the name "Atticus".
- table = new SimpleTable("baby-2010.csv");
- for (row: table) {
- if(row.getField("name") == "Atticus"){
- print(row);
- }
- }
- ----------------------------------------------------
- Write code to print the rows for the name "River". In this case, there are two such rows, but the same basic code pattern as for question 1 works. This shows how the loop really is just testing every row.
- table = new SimpleTable("baby-2010.csv");
- for (row: table) {
- if(row.getField("name") == "River") {
- print(row);
- }
- }
- ----------------------------------------------------
- Write code to print the rows where the rank is less than (<) 10, i.e. ranks 1 through 9.
- table = new SimpleTable("baby-2010.csv");
- for (row: table) {
- if(row.getField("rank") < 10) {
- print(row);
- }
- }
- ----------------------------------------------------
- Write code to print the rows where the rank is greater than 950.
- table = new SimpleTable("baby-2010.csv");
- for (row: table) {
- if(row.getField("rank") > 950) {
- print(row);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement