Question: pls advise some code We wish to compute the sum of all odd integers between nt and n2. Note that ni and n2 are either,

pls advise some code We wish to compute the sum of allpls advise some code

We wish to compute the sum of all odd "integers" between nt and n2. Note that ni and n2 are either, both long integers or both "big" integers and n2 is always greater than n. Compare the design using 5 different methods. The following UML diagram shows the five different methods: Supp4 -static long sumodd itong nilonen -static lone sumOdd Lalong ni, long n2) -static BigInteger sumOdd B(BigInteger nt. BigInteger n2) -static long sumOdd R(long n1, long n2) -static BigInteger sumOdd BR(BigInteger n1. Blanteger n2) + static void main(String args) (a) The 15 method, an iterative version, uses any type of loops and receives two long parameters (b) The 2nd method, uses the LongStream in Lambda and stream, receives two long parameters (c) The 3rd method, an iterative version, receives two BigInteger parameters and the return type is also a BigInteger (d) The 4th method, a recursive version, receives two parameters of long types with long return type. (e) The 5th method, a recursive version, receives two BigInteger parameters and the return type is also a BigInteger In the main method, generate two integers nt and n2 make sure that n2 is greater than n1, invoke the 5 methods and display the results. Upon execution of your program, you will see the following sample output: The sum of all odd integers between 6484 and 6798 is (Iterative version) = 1300397 (Lambda version = 1300397 (BigInteger Iterative version) = 1300397 (Recursive version) = 1300397 (BigInteger Recursive version) 1300397

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!