import java.io.*;
import javagently.*;

class Summation1 {

  /* The first Summation program   by J M Bishop Aug 1996
   * ---------------------------   Java 1.1 Oct 1997
   *
   * Reads in numbers interactively and displays their sum.
   * Illustrates the declaration of an input stream
   * and simple use of the Text class. 
   */

  public static void main(String[] args) throws IOException {

    int count;
    double total = 0; 
    double number;        
	
    BufferedReader in = Text.open(System.in);

    System.out.println("****** Summing numbers ******");

    Text.prompt("How many numbers?");
    count = Text.readInt(in);

    for (int i = 1; i <= count; i++) {
      System.out.print(i+"> ");
      number = Text.readDouble(in);
      total += number;
    }
    System.out.println("That's enough, thanks.");
    System.out.println("The total is "+total);
  }
}

