 |
 |
 |
 |
 |
 |
 |
 |
 |
//
Read and sum until end of line
|
|
int
thisBP; int total; int count;
|
|
count
= 1; // Initialize
|
|
total
= 0; String line;
|
|
line =
dataFile.readLine();
|
|
while
(line != null) // Test expression
|
|
{
|
|
thisBP = Integer.parseInt(line);
|
|
total = total + thisBP;
|
|
count++; // Update
|
|
line = dataFile.readLine();
|
|
}
|
|
System.out.println(“The
total = “ + total);
|