w is 25.0 x is 1.0
Our goal is to write a program that computes the following sum:
sum = 1/1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6
(This may look like a pointless thing to do, but you will see such sums in calculus and elsewhere, where they are called an harmonic series.) Here is a skeleton of the program:
public class HarmonicTester { public static void main ( String[] args ) { int term=1, lastTerm = 6; double sum = 0.0; while ( term <= lastTerm ) { ; // add the next term to sum ; // increment term } System.out.println("Sum of 6 terms:" + sum ) ; } }
Fill in the two blanks to complete the program.