Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ex.java This program computes an estimate of the value of the mathematical value e x , which is defined, for a given exponent x, and

Ex.java

This program computes an estimate of the value of the mathematical value ex, which is defined, for a given exponent x, and for n > 0 terms of a series, as:

As n is made greater, the estimate of ex becomes more precise. If the computation is done with double computations, then after some number of additional terms (some value of n), the available precision of the double representation will be reached, and no further improvement will be seen. However, for large values of x, it may not be possible to obtain an estimate, due to the result being too large.

The value computed should be a Java floating-point value (please use double ). The program should first ask the user for an integer value n 0, which indicates the number of terms to be used in the evaluation of the estimate. If the value entered is less than zero, a message must be given the user, and the user allowed to try again. If the value for the number of terms is 0, the program should just exit.

If the number of terms value is greater than 0, then the user should be asked to enter a value for the exponent x. The exponent may be any double value, positive or negative, zero or fractional.

As before, make the program continue to loop requesting new values of n and x to compute new estimates, until the user asks for a zero number of terms to be used.

Some values of the exponent will prevent the program getting correct results. If the correct value cannot be computed, tell the user that is the problem, and keep asking for another number of terms and an exponent value until an acceptable number (or 0) is entered. (Note that if the exponent, x == 1, then the value obtained should be for just the value of e itself. It should always be possible to obtain an estimate for this value, for any number of terms.)

Print out your estimates of the value of e raised to the given power to at least 15 significant places.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions