Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 407 Weeks Ago, 6 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 28 Aug 2017 My Price 9.00

implement seriesIter,

   

Consider a method which calculates and returns the following series:

S(i) = 1 + 1/22 + 1/32+ 1/42 + 1/52 Ac€¦ + 1/i2 .

The argument (i) has to be provided by user. The output is the value of S(i) which should be displayed either in the output window of the IDE, or in a GUI (however, designing a GUI is not mandatory, and your work is considered for full grade without a GUI).

a)  Design and implement seriesIter, the iterative version of the method.

b)  Design and implement seriesRec, the recursive version of the method.

c)  Write a driver program TestSeriesVal.java to test the two methods.

package recursion;

import java.util.Scanner;

class Recursion {
    public static double recursion(int n)
    {
       // base case
       if (n >= 1)
       return 1;
       return 1.0/n + Math.pow((recursion(n-1)),2);
             
    }
    public static void main(String[] args) {
        //test file
       Scanner input = new Scanner(System.in);

       System.out.println("Enter a integer: ");
       int n = input.nextInt();
       System.out.println("The answer is" + n);
    }
  
}

This is not giving me correct output and I do not know why.

 

Answers

(5)
Status NEW Posted 28 Aug 2017 11:08 AM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)