Wednesday, March 30, 2011

Week 4 Tutorial marked

The week 4 tutorial was due today (see this entry for what was required)

I spent a decent amount of time of this tutorial, and I found implementing Date objects to be quite obtuse. My main struggle was how to find the number of days between the endDate and today. Google taught me that, although there wasn't a Date.subtract method, there was a Date.add method, and you can pass a negative date to subtract. Except that didn't really help me work out how many days that was.

In the end, I subtracted one Date from the other, and, as they are both stored in milliseconds, I divided by (1000 * 60 * 60 * 24) (milliseconds to seconds, seconds to minutes, minutes to hours, hours to days). Although not very elegant, it was the same as Eddie's solution, so correct.

I didn't get much satisfaction out of that. I want my solutions to be nicer than that. Oh well!

Anyway, I got 10/10 again, which is good. I'm hoping to get really good marks for the assessment and assignments, as I'm a bit worried that the exam is worth 60% overall.

No comments:

Post a Comment