Exersice:
Weather Data:
In weather.csv you’ll find daily weather data for Morristown, NJ for June 2002. Download this text file, then write a function that return the day number (column one) with the smallest temperature spread (the maximum temperature is the second column, the minimum the third column).
- If List of String is empty or null return -1.
- If two days has same spread return the first one.
- Return the day number with the smallest temperature spread.
You need to Follow Three Rules of TDD
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
- You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
weather.csv
has all the records required for parsing.
weatherTest.csv
has one record line used for testing file input.
In the Java
folder you'll find TDD.java
and TDDTest.java
with getDataFromFile
function implemented.
In the Python
folder, you'll find tdd.py
and test_tdd.py
.
You will need to develop tests in test_tdd.py first, and then develop corresponding functions in tdd.py
.
In the NodeJS
folder you havetest.js
inside test
folder.
You have to develop tests in test.js
first, and then implement respective methods in readFile.js
.