I need to write a program that asks the user to type in a maximum value for the
ID: 3630217 • Letter: I
Question
I need to write a program that asks the user to type in a maximum value for the error in the approximation, where this error is the difference between the calculated approximate value and the real value of e. Then have the program display the final value of e obtained by each series and the number of iterations required to get the input accuracy for e. For the real value of e in my program, we have to use the value 2.71828182845904523536. This program should work for errors as small as 0.00000001. The approximation should display correctly to twelve decimal places.ex. given
e= (1+ 1/1!+ 1/2! +1/3! + 1/4! +....+ 1/n!)
I along with the rest of the class is really lost on how to do this problem so if you could help it would be greatly appreciated. This is also my first programming class
Explanation / Answer
I believe this is what you are looking for? (Written in java): public class eCalculator { private static final double e = 2.71828182845904523536; public static void main(String[]args){ java.util.Scanner keyboard = new java.util.Scanner(System.in); System.out.println("Enter the maximum value for error in approximation."); double maxError = keyboard.nextDouble(); double currentError = 100000; double currentE = 1; int loopNumber = 1; while (maxErrorRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.