Why is that this simple operation in a for loop such as this one returns 0.0?
totaalPunten += (moduleScore * (double)(moduleStudiePunten/totaalStudiepunten));
Where totaalPunten is a double initialized outside of the for-loop as 0, moduleScore (i.e. 12.0) and moduleStudiePunten (i.e. 6) are the following:
double moduleScore = entry.getValue().getScore();
int moduleStudiePunten = entry.getValue().getAantalStudiePunten();
entry is a HashMap entry. totaalStudiepunten is an int which is always 30. I'm not even sure if I should be casting (moduleStudiePunten/totaalStudiepunten) to double. Either way, I'm stumped as to how this isn't working. Does it have something to do with the way incrementing works? It's quite likely I have a made a huge mistake in Java considering I'm starting to get familiar with it coming from C# (student).