Project #57322 - java HW

A Progressive Problem

 

Objective:

 

Write a class called MathProgressions which has a main method (NOPE! NO DRIVERS THIS WEEK), and two methods which will calculate the geometric and harmonic progressions via a recursive method.

 

 

The class MathProgressions needs to have the following:

  • Make sure to import java.util.*;
  • Static Methods
    • Main method which handles all of the input and output.  The user is asked to enter a number and then for that number it gives both the geometric and harmonic progressions for every number up until (and including) that number.
    • geometric: Is a method which takes in a number and then returns that value of the number in the geometric sequence.  The geometric sequence is represented by:

 

 

Which mean it’s the product of all of the numbers up until that number.

 

    • harmonic: Is a method which takes a number and then returns the value of the number in the harmonic sequence.  The harmonic sequence is represented by:

Which means the product of the inverse of the first n numbers.

  • NOTE: MAKE SURE EACH OF THESE ARE SOLVED RECURSIVELY AND NOT WITH A LOOP OR ELSE -79 FOR YOU!!!
  • NOTE: YOU MAY USE A LOOP TO PRINT OUT THE PROGRESSION BUT NOT FOR THE CALCULATION

 

Example Dialog:

 

Enter a number and I'll give you the geometric and harmonic sequences

10

Geometric is:

1=1.0 2=2.0 3=6.0 4=24.0 5=120.0 6=720.0 7=5040.0 8=40320.0 9=362880.0 10=3628800.0

Harmonic is:

1=1.0 2=0.5 3=0.16666666666666666 4=0.041666666666666664 5=0.008333333333333333 6=0.0013888888888888887 7=1.9841269841269839E-4 8=2.4801587301587298E-5 9=2.7557319223985884E-6 10=2.7557319223985883E-7

Finally:

Upload the .java file

Subject Computer
Due By (Pacific Time) 02/11/2015 01:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy