ArrayList Data Structure – Daily Temperature

You never enter any data into temperatures.

Therefore temperatures.size() == 0

Anything divided by 0 is NaN

So the code is doing exactly what you told it to.

Leave a Comment