Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ class that is derived from the Progression class to produce a progression where each value is the absolute value of the difference

Write a C++ class that is derived from the Progression class to produce a progression where each value is the absolute value of the difference between the previous two values. You should include a default constructor that starts with 2 and 200 as the first two values and a parametric constructor that starts with a specified pair of numbers as the first two values.

Prorgression Class

int main()

{

Progression* prog; // test ArithProgression

cout << "Arithmetic progression with default increment: ";

prog = new ArithProgression();

prog>printProgression(10);

cout << "Arithmetic progression with increment 5: ";

prog = new ArithProgression(5);

prog>printProgression(10); // test GeomProgression

cout << "Geometric progression with default base: ";

prog = new GeomProgression();

prog>printProgression(10);

cout << "Geometric progression with base 3: ";

prog = new GeomProgression(3);

prog>printProgression(10); // test FibonacciProgression

cout << "Fibonacci progression with default start values: ";

prog = new FibonacciProgression();

prog>printProgression(10);

cout << "Fibonacci progression with start values 4 and 6: ";

prog = new FibonacciProgression(4, 6);

prog>printProgression(10);

return EXIT SUCCESS; // successful execution

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions