The completed program is given below.
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) );
}
}