Visual Basics Exercie
Posted: Sat May 22, 2010 11:41 am
Hi anybody,
I have a VB exercie, can anybody help me???
A file of unknown length contains the temperature values of a chemical reaction. Such
values can have decimal digits, they appear on many rows and they are separated by one
or more spaces. Temperatures are measured every two minutes and the first measurement
is taken when the reaction starts. Therefore they refer to minutes 0, 2, 4, 6, …
Write a program that asks the user for the name of this file, asks the user for the name of
an output file to be created, reads all the values from the first file and writes to the second
file the temperature values of every minute, including odd minutes (1, 3, 5…). As these
values are not present in the input file, the program must estimate them as the average
between the previous and the following read (even placed) value. Each output value must
appear on a different row. See next example for reference.
Example:
Content of input file:
21.2 37.4 43.4 40.2 46.12
50.33 34.6 32.5
31.2 33.2 33.4 40.23
...etc...
Resulting output file:
21.2 -> first read value
29.3 -> average between 21.2 (previous value) and 37.4 (following value)
37.4 -> second read value
40.4 -> average between 37.4 (previous value) and 43. 4 (following value)
43.4 -> third value
...etc...
I have a VB exercie, can anybody help me???
A file of unknown length contains the temperature values of a chemical reaction. Such
values can have decimal digits, they appear on many rows and they are separated by one
or more spaces. Temperatures are measured every two minutes and the first measurement
is taken when the reaction starts. Therefore they refer to minutes 0, 2, 4, 6, …
Write a program that asks the user for the name of this file, asks the user for the name of
an output file to be created, reads all the values from the first file and writes to the second
file the temperature values of every minute, including odd minutes (1, 3, 5…). As these
values are not present in the input file, the program must estimate them as the average
between the previous and the following read (even placed) value. Each output value must
appear on a different row. See next example for reference.
Example:
Content of input file:
21.2 37.4 43.4 40.2 46.12
50.33 34.6 32.5
31.2 33.2 33.4 40.23
...etc...
Resulting output file:
21.2 -> first read value
29.3 -> average between 21.2 (previous value) and 37.4 (following value)
37.4 -> second read value
40.4 -> average between 37.4 (previous value) and 43. 4 (following value)
43.4 -> third value
...etc...