MUST BE DONE IN JAVA Assignment : Write an algorithm, in java, and program to co
ID: 3781783 • Letter: M
Question
MUST BE DONE IN JAVA
Assignment: Write an algorithm, in java, and program to compute , using the formula/algorithm described in the text - refer to P1.3 on page 29.
Output: Output will include your computed value for , the math library constant expected value for and the number of iterations it took to reach six-significant digit accuracy. The number of iterations could exceed 250,000. Make your output clean, labeled and easy to read for comparing results.
Input: No user input.
Requirements: Use only material covered in the first six chapters. Style requirements as discussed in class expected.
Efficiency should always be considered. Always choose the most appropriate loop/decision structures and variable types. No rounding is required or allowed.
You may NOT use the math library constant for in your computation - directly or indirectly. Use ONLY the delta (difference) of your running computation to determine when to stop your loop.
Submission: Your program must be able to compile and execute on FIU SCIS, using the “java” compiler.
Please name your source code file: ComputePI.java .
Explanation / Answer
public class ComputePI { public static void main(String[] args) { double sum = 0; for(int i=0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.