Question: Write the C++ classes called ArithmeticProgression and GeometricProgression that are derived from the abstract class Progression, with two pure virtual functions, getNext() and sum(), see

Write the C++ classes called ArithmeticProgression and GeometricProgression that are derived from the abstract class Progression, with two pure virtual functions, getNext() and sum(), see the course textbook p. 8790 for more details. Each subclass should implement these functions in order to generate elements of the sequences and their sums. Test your program for the different values of d, r and the number of elements n in each progression. What is the classification of those functions: getNext() and sum() in terms of the Big-O notation?

Recall the definitions of the arithmetic and geometric progressions. Definition: An arithmetic progression with the initial term a and the common real difference d is a sequence of the form a, a + d, a + 2d, . . . , a + nd, . . . Definition: A geometric progression with the initial term a and the common real ratio r is a sequence of the form a, ar, ar2 , . . . , arn, . . .

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!