Hi everyone!
im a complete java beginner and stuck trying to write some java programmes.
Please can anybody help me?
the questions are.....
1)'The Heron method is a method for computing square roots that was known to the ancient Greeks.If x is a guess for the value of the squareroot of a , then the average of x and a/x ia a better guess.
Implement a class RoorApproximator that starts with an initial guess of 1 and whose nextGuess method produces a sequence of increasingly better guesses.Supply a method hasmoreGuesses that returns 'false' if two successive guesses are sufficiently close to eaach other. Then test your class like this:
Rootapproximator r = new RootApproximator(n);
while (r.hasMoreGuesses())
System.out.println(r.nextGuess()); '
2) Write a java programme that computes e^x using the power series - e^x = sum from 0 to infinity of (X^n / n!).
I reckon anyone who knows java will understand my problems as a complete beginner lol. So if anyone could help me with this programme it would be much appreciated....
Thanks everyone
x
im a complete java beginner and stuck trying to write some java programmes.
Please can anybody help me?
the questions are.....
1)'The Heron method is a method for computing square roots that was known to the ancient Greeks.If x is a guess for the value of the squareroot of a , then the average of x and a/x ia a better guess.
Implement a class RoorApproximator that starts with an initial guess of 1 and whose nextGuess method produces a sequence of increasingly better guesses.Supply a method hasmoreGuesses that returns 'false' if two successive guesses are sufficiently close to eaach other. Then test your class like this:
Rootapproximator r = new RootApproximator(n);
while (r.hasMoreGuesses())
System.out.println(r.nextGuess()); '
2) Write a java programme that computes e^x using the power series - e^x = sum from 0 to infinity of (X^n / n!).
I reckon anyone who knows java will understand my problems as a complete beginner lol. So if anyone could help me with this programme it would be much appreciated....
Thanks everyone
x