Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

hellllppppp pleeeeeease! java algorithms!?

can someone plz provide some insight on this?

A cancellation error occurs when you are manipulating a very large number with a very small number. The large number may cancel out the smaller number. To obtain more accurate results, the order of computation must be selected carefully. Write a Java program (with the main method) that compares the results of the summation of the following series computing from left to right and right to left.

1 + 1/2 + 1/3 + ..... + 1/n

Your program should then ask the user to enter a positive and greater than zero number, calculate the summation from left to right, calculate the summation from right to left and display appropriate messages with the two calculated summations.

Example test data:

for n=50000 you should see:

L-R: 11.397003949278504

R-L: 11.397003949278519

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Why should I be doing your homework for you?

  • 1 decade ago

    The specs are pretty straight forward. Do you have a specific question about the code? This is an easy problem.

    The reason why you have a difference in answers depending on whether you start adding from the right or the left end of the series is that you have a different loss of significant digits during each process.

    From a scientific point of view this is not a big deal as you never have 16 significant digits. If you have 6 significant digits that is pretty good in most experimental sciences.

    If you are having problems that simply means you are not asking your instructor enough questions because you don't know what questions to ask, because you haven't read the book enough times to figure out what you are getting confused over, perhaps because you don't know how to study?

    I don't write Java code for people without charging them at $70 per hour.

  • Lily
    Lv 4
    1 decade ago

    Jesus woman ! Ask your professor. Who wants to do maths at this time of night?????????

  • Anonymous
    1 decade ago

    good question, but I fear that would be an ecumenical matter..........

    Source(s): Fr. Ted
Still have questions? Get your answers by asking now.