A good answer might be:

The completed program is given below.


Complete Program

Here is the complete program:

import java.io.* ;
class HarmonicSeries
{
  double value( int limit )
  {
    int term=1 ;
    double sum = 0.0;
    
    while ( term <= limit )
    {
      sum += 1.0/term;           // add the next term to sum
      term++ ;                   // increment term
    }

    return sum;
  } 
}

class HarmonicTester
{
  public static void main ( String[] args ) throws IOException
  {
    BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in) );
    HarmonicSeries series = new HarmonicSeries();
    int limit = Integer.parseInt( stdin.readLine() );

    System.out.println("Sum of " + limit + " terms:" + series.value( limit) );
  }
}

QUESTION 13:

With my 750 MHz AMD Athlon computer it takes 22 seconds to run the program with the limit set at 1,000,000,000. Is your computer slower or faster than mine?