Question
Java - COP3337 Assignment : Write an algorithm (pseudocode) and program to compute . The approximation of the important mathematical constant will be done using
Java - COP3337
Assignment: Write an algorithm (pseudocode) and program to compute . The approximation of the important mathematical constant will be done 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 , the required delta, the desired decimal-place accuracy, and the number of iterations (loop executions) it took to reach the required decimal-place accuracy. Make your output clean, labeled, and easy to read for comparing results. No rounding is allowed. Sample output can be found below.
Input: Program will prompt a user to provide the desired decimal-place accuracy, in the range of [2-9]. User prompt must clearly indicate what is a a valid input. User input will be range-validated - ensuring that the integer value entered is between 2-9, inclusive.
Requirements: Use only material covered in the first six chapters.
Efficiency should always be considered. Always choose the most appropriate loop/decision structures and variable types. No rounding is allowed. Use of appropriate constants expected - e.g. for expected value, required delta.
Your main method should reflect your high-level design - no low-level tasks in the main. Use additional static methods to support the main method, as required in order to complete the tasks identified in your design.
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. [Hint: consider when the delta between subsequent computations ceases to meaningfully affect your computation.]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started