Write a Java program named HarmonicSeries that sums the terms of the Harmonic series:
Harmonic Series
Write a Java program named HarmonicSeries that sums the terms of the Harmonic series: 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 . . .
Your program should accept from the console a double number representing a limit, determine the minimum number of terms which when summed will exceed that limit, and report the actual sum of those terms.
For example, a user input to the console of 1.5 should result in this console output:
Actual sum = 1.83333
Number of terms required: 3
In other words, a minimum of 3 terms of the Harmonic series are required to exceed the sum of 1.5, and the sum of those 3 terms is 1.83333 (rounded).
Use printf to round your sum to the nearest 5th decimal place as in the example above. Your sum must be rounded, not truncated.
Other test cases, not available to you, will also be tested. Assume that the target sum will always be in the range 1 to 10. (In fact, be careful not to test for sums much larger than 10 because your program might take many precious seconds to execute.)
Be sure to match the format of the example EXACTLY. There are two lines of output with no blank lines and no trailing spaces.
1
Required Output
Actual sum = 1.50000\n
Number of terms required: 2\n
Test Case 2
1.5
Required Output
Actual sum = 1.83333\n
Number of terms required: 3\n