
The difference between
floating-point division and
integer division is
explained in Chapter 2.
REFERENCE POINT
300 CHAPTER 6 Flow of Control,Part 2: Looping
simply print a message saying that no grades were entered. If count is not 0,
we calculate and print the average. We first instantiate a DecimalFormat
object (line 37) so that we can output the average to one decimal place.
Remember that we need to type cast the total to a double (lines 38–39) to
force floating-point division, rather than integer division.
6.4.4 Finding Maximum or Minimum Values
In Chapter 5, we illustrated a method for finding the maximum or mini-
mum of three numbers. But that method ...