CS 2401 Assignment #1

Due Date: Sunday, January 31, 2010.

Objective: The goal of this assignment is to refresh your memory of 1-dimensional arrays, in preparation for the following lab on multi-dimensional arrays.

Background: To better trace climate change, UTEP is participating in an effort to set up meteorological sensors at various locations. These sensors are run automatically, and it is known that sometimes, when the weather changes drastically (sudden snow or hail), the sensor readings become unreliable. For example, a sensor buried under snow no longer correctly records the outside temperature or the wind velocity.

To be able to correctly process the sensor data, it is important to detect such sensor errors. One way to detect these errors is to compare the readings of two nearby sensors. If the difference between these readings exceeds a certain threshold, then both sensor readings are suspicious (unreliable).

For example, if the temperature threshold is 5 degrees, then readings of 50 and 54 are both reliable, but if the readings are 50 and 60, with a difference of 10 degree, then both readings are unreliable.

Assignment: Let us assume that we have two nearby temperature sensors. Each sensor records the temperature daily. To store the information, we use two one-dimensional arrays:

Based on these two arrays, you need to:

Assume that the data is stored in two files corresponding to two sensors, each transaction in a separate line.

Example. Assume that we had 3 days of measurement. During these three days, the first sensor recorded the values 50, 51, and 60, and the second sensor recorded the temperatures of 52, 60, and 59. In this case, the first input file is as follows:

 50 
 51
 60
and the second input file is:
 52
 60
 59
Then, the first array will have the values 50, 51, and 60, and the second array will have the values 52, 60, and 59. This means that: If we assume the threshold to be 5, then the first and third day measurements are reliable, with absolute value of the differences 2 and 1, but the second day was unreliable, with a difference 9 exceeding the threshold. So, the array rel should contain true, false, and true. The seasonable average is then equal to the average of two reliable values measured by the first sensor, i.e., to (50 + 60)/2 = 55.

Deliverables: Your TA will instruct you.