sequenceSum

Category: Programming
Author: Marty Stepp
Book Chapter: 5.1
Problem: sequenceSum
Write a static method named sequenceSum that prints terms of the following mathematical sequence:

1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + ...

Your method should accept a real number as a parameter representing a maximum limit, and should repeatedly add and print terms of the sequence until the overall sum of terms meets or exceeds the maximum limit that was passed. For example, if your method is passed the value of 2.0, you should print terms of the sequence until the sum of all those terms is at least 2.0. The following output would result from the call sequenceSum(2.0);

1 + 1/2 + 1/3 + 1/4 = 2.083333333333333

(Despite the fact that the terms keep getting smaller, the sequence can actually produce an arbitrarily large sum if enough terms are added.) If your method is passed any value less than 1.0, no output should be produced. You must match the format of the output shown exactly; note the spaces and pluses separating neighboring terms.