So what kind of solution would you get for this problem?

AFB

Lifer
Jan 10, 2004
10,718
3
0
You are supposed to write a simple prgram to predict snow fall based on certain constants and the number of hours it snowed read from a file. Snow falls at a rate of 1 inch per hour and evaporates at a rate of 2% per hour. This isn't homework, I have multiple solutions. I just want to see what type you'all get. Don't even both coding it, I just want to see others logic on how to solve it.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
This problem is trivial if you treat the new snow as arriving instantly as one clump at the end of the hour with no evaporation.

It's a little more interesting if you treat the snowfall as occurring evenly throughout the hour, with fractional evaporation also occurring. Still pretty easy if you calculate using intervals of minutes or seconds, but I'd have to do a little thinking to calculate it continuously.
 

AFB

Lifer
Jan 10, 2004
10,718
3
0
There was no clarification. The reason I asked is it turns out you were supposed to just multiply the hours by 1 and then multiply by .98 for the total amount to account for evaporation. My problem with this is it said evaporation was hourly, thus making the 2% hourly as well which is not the same as 2% of hours times 1. I think their answer is complete BS, but whatever.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
The whole problem is ridiculous. It says that if you have 8" of snow on the ground, it will evaporate twice as quickly as where there is 4 inches of snow on the ground.
 

AFB

Lifer
Jan 10, 2004
10,718
3
0
Originally posted by: notfred
The whole problem is ridiculous. It says that if you have 8" of snow on the ground, it will evaporate twice as quickly as where there is 4 inches of snow on the ground.

Yeah, the other problems aren't any better.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Originally posted by: amdfanboy
There was no clarification. The reason I asked is it turns out you were supposed to just multiply the hours by 1 and then multiply by .98 for the total amount to account for evaporation. My problem with this is it said evaporation was hourly, thus making the 2% hourly as well which is not the same as 2% of hours times 1. I think their answer is complete BS, but whatever.
Yes, their solution makes no sense if you're stating their formula correctly since it ignore "compounding."

Here's the "instant snow clump" version with the clump arriving at the end of the hour. Evaporation is on the previous hour's total. You could also calculate with the snow clump arriving at the beginning of the hour, but you still won't get their result.

hour 1 +1 - 0 = 1
hour 2 +1 - .02 = 1.98
hour 3 +1 - .0396 = 2.9404
...