/** * Title: Chapter 3, "Control Statements" * Description: Chapter 3 Examples * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // TestSum.java: Compute sum = 0.01 + 0.02 + … + 1; // package chapter3; public class TestSum { /**Main method*/ public static void main(String[] args) { // Initialize sum float sum = 0; // Keep adding 0.01 to sum for (float i=0.01f; i <= 1.0f; i = i+0.01f) sum += i; // Display result System.out.println("The summation is " + sum); } }