CS 1401, Quiz 10

Date: Wednesday, April 2, 2008
Name (please type legibly, ideally in block letters): ______________________________________________________________________

This year the weather in El Paso is unusually cold. Let us help the climatologists analyze the data. Let us assume that the low temperatures in February are stored in the array low:

1. Write a piece of code that, given this array, prints all the days in February on which the low temperature was below freezing (i.e., below 32 degrees), and prints the corresponding low temperatures.

2. To check the correctness of the code you wrote in Problem 1, write a piece of code that defines a new simplified array low consisting of 3 elements of type integer and assigns, to elements of this array, values 0, 45, and 30. Trace step-by-step how the piece of code you wrote in Problem 1 will perform on this array. It should print something like this:

February 2: low temperature 30