Grade-Point-Average
Download Source Code

Float vs Int
In Java, any number written without a decimal point is assumed to
be an integer (int)
value.
As soon as there is a decimal point written, the number is a floating point (float) value.
Usually a float value is
better than an int value,
because:
- float values can be
larger, up to 1038
- float can have
decimals, and will allow correct division operations
Practice
- Calculate the average of the following ages:
25 students are 15 years old
45 students are 16 years old
30 students are 17 years old
- Add up the following:
1+3
1+3+5
1+3+5+7
...
1+3+5+7+....+97+99
Is there a pattern?
- Explain why adding up int values
gives correct answers,
but dividing int values gives incorrect answers.