Question: Topic 9: Loops Requirements for chapter 9 zyLab: Loops Full Program Program Concept The natural logarithm of 2 is approximately: In(2) -0.693147180559945309417232121458... Various formulas exist




Topic 9: Loops Requirements for chapter 9 zyLab: Loops Full Program Program Concept The natural logarithm of 2 is approximately: In(2) -0.693147180559945309417232121458... Various formulas exist for calculating the natural logarithm of 2. One approach is to calculate the value via a sum of fractions, using the following series. The more terms used in the series, the better the precision of the natural logarithm of 2 that is calculated. In (2) 1/1-1/21/3- 1/4+ 1/5- 1/6+... As you might have noticed, calculating the value of this series only requires performing elementary arithmetic. Notice that the terms in the denominator consist of increasing integers and each subsequent term alternates between being added to or subtracted from the previously summed terms. For example, the value of natural logarithm of 2, using the first four terms in this series is In (2) 1/1- 1/21/3- 1/4- 0.58 (not very accurate with only 4 terms!) The more terms that are used, the closer the approximation will become to natural logarithm of 2's actual value Things to notice about this series the numerator of each term is always the same (1) the value of the denominator in the terms consists of increasing numbers each subsequent term alternates between being added to or subtracted from the previously summed terms e You will write a program logarithm of 2 for a user specified number of terms based on the series described above that calculates the value of natural This program will display the calculations every X times it does the calculations. X, known as the display count, will be specified by the user. For example, if the user inputs a display count of 10, t after the 10th, 20th, 30th, etc. term has been summed (see sample outputs below) hen the program should display the results Implementation Requirements The program will be written in NetBeans Create a new project named With a main class named Topic9project NatLog2Approximator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
