Computer Science 252
Problem Solving with Java
Fall 2013, The College of Saint Rose
Agenda
Due at the start of class, Tuesday, December 3.
Please submit answers to these questions in Submission Box under "LA19" by the start of our next class. We will discuss these questions at the start of class, so no late submissions are accepted. Please be sure that your name is clearly indicated in all submissions.
private void doSomething() {
int [] report = { 5, 4, 10, 4, 6, 3, 4 };
int turn = 0;
int shot = 0;
int lastTotal = 0;
while (shot < report.length && turn < 10) {
int increment = report[shot] + report[shot+1];
if (increment >= 10) {
increment += report[shot+2];
}
if (report[shot] < 10) {
shot++;
}
lastTotal += increment;
shot++;
turn++;
System.out.println(shot + " : " + lastTotal);
}
}
Examples