public class ProblemC { public static void main(String[] args) { double limit = 0.0000000001; int i; double e = 1.0; double partial =1; Calculate_E calculateObject = new Calculate_E(); for( i = 1; partial > limit; i++) { partial = calculateObject.partial_E(limit, i); e = e + partial; //each loop adds 1!, 2!, 3!, 4!, etc } System.out.println("\nNumber of terms = " + i); System.out.printf("Approximation = %f", e); } }

Class 2:

public class Calculate_E { public double partial_E(double limit, int i) { double n = 1; int j; for (j = 1; j <= i; j++){ n = n*j; } return n; } }

This post has been edited by **pbl**: 08 October 2012 - 01:54 PM

Reason for edit:: Fixed code tags