CS 1401 Homework #7

Date Assigned: Tuesday, March 1, 2005

Due Date: Thursday, March 3, 2005, before the beginning of your lecture section.

Goal: the goal of this assignment is to practice with Java while loops.


1.      Problem #16 (a) and (b) on p. 260-261 in your textbook.  NOTE:  Assume the data values are written one per line.

(a)  In addition to showing the contents of sum and number after the loop exit, trace the changing values of these variables here:





 (b)  Answer the question in the book.  In addition, show a reasonable test plan in the space below if you think that the data given does not fully test the code.






2.      Problem #10 (a) and (b) on p. 263 in your textbook. 

(a)  Show the three different versions (label them 1, 2, and 3) of the whole loop below:





 (b)  Specify which of the three versions above answers the question in the book.




3.      Problem #14 on p. 263 in your textbook.  Use your own file name.