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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started