Computer Science 252
Problem Solving with Java
Spring 2016, The College of Saint Rose
Agenda
Due at the start of class, Thursday, April 21.
Please submit answers to these questions either as a hard copy (typeset or handwritten are OK) or by email to terescoj AT strose.edu by the start of class. Please use a clear subject line when submitting by email (e.g., CSC 252 Lecture 22 Assignment, Mary Smith). We will discuss these questions at the start of class, so no late submissions are accepted.
private void mystery() { 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 = increment + report[shot+2]; } if (report[ shot] < 10) { shot++; } lastTotal = lastTotal + increment; shot++; turn++; System. out. println(shot + " : " + lastTotal); } }
Examples