Design and implement the class GeometricSequence that represents the geometric sequence a, a x r, a x r2, a x r3, a x r4, a x r5, ... The class should have the following private data fields: • The...


Design and implement the class GeometricSequence that represents the geometric sequence


a, a x r, a x r2, a x r3, a x r4, a x r5, ...


The class should have the following private data fields:


• The first term, a, in the sequence


• The ratio r between successive terms in the sequence


• The value of the current term in the sequence


• The value of the exponent for the current term in the sequence


Include a reasonable constructor, an accessor method for each data field, and a method toString. In addition, provide a mutator method for each of the following tasks:


• Replace the current term in the sequence with the next term


• Reset the current term in the sequence to the initial term in the sequence


Write a program that tests your class definition.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here