Jesus! What a horror story. I don't get how the professor concluded that he was entitled to your time like that.
Agreed that it's best to cut off things like this early. Some programmers need to learn the value of their own time -- and act accordingly. If you don't respect your own effort, other people never will.