Free University of Bolzano/Bozen
Faculty of Computer Science - Bachelor in Applied Computer Science
Bachelor in Production Engineering
Introduction to Programming - A.A. 2004/2005

Exercise
Class Experiment

Part 1: Design and realize a Java class Experiment to maintain the information on the data measured during an experiment. The data are passed in the form of a text string containing integer values (at least one), separated by blank spaces. The following functionalities should be offered by the class Experiment:

To realize the various functionalities you should use objects of the class StringTokenizer, created starting from the string that represents the measured data.

Part 2: Write a client of the class Experiment that:

  1. Reads from input (using the method JOptionPane.showInputDialog) a set of integer values, and accumulates them in a string of integers separated by blank spaces, until the user presses the Cancel button.
  2. Creates an object of the class Experiment.
  3. Prints the number, the sum, the average, the minimum, and the maximum of the inserted values.