So this is a basic question, I have 2 int
variables or field as it is called in Java. One is total score the other is game rounds. I am using double
which takes decimal numbers as the data type for average
variable. But I'm not getting the correct result.
int totalScore = 75;
int gameRounds = 2;
public void calculateAverage() {
double average = totalScore / gameRounds;
System.out.println(average);
}
The result is: 37.0
, why isn't it the result 37.5, even though I'm using the correct datatype?