A geometric sequence is a sequence of numbers where each term after  the  first  is found  by  multiplying  the  previous  one  by  a   fixed,   non - zero   number   called  the common ratio. For example, the sequences 2, 6, 18, . ... 3, 15, 75 , …. are a geometric sequences with common ratios 3 and 5 respectively. A geometric sequence is generally characterized by three numbers, the  first  term  ‘ a’,  the  common ratio ‘ r’ and the number of terms ‘ n’. A geometric  series is  the sum of  numbers in a geometric sequence. 2+ 6+ 18 and 3+ 15+ 75 are examples of geometric series with three terms each.   The nth term of a geometric series with initial value ‘ a’ and common ratio ‘ r’ is given by: ?? = ???−1. While the sum of a geometric series is given by: ?(1-??−1) / 1-??−1 Create a class Geometric Series to model a Geometric series. Using friend function, overload the ‘~’ operator to  find  the  nth  term  of  the  series. Likewise, overload the ‘!’ operator (using a friend function) to find the sum of a Geometric series.   Provide a function display() in the class to display the geometric series. Sample output of the program should be like the following.   Sample Program Output GeometricSeries series (1,2,4); cout<<"Nth term is: "<<~series<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

A geometric sequence is a sequence of numbers where each term after  the  first  is found  by  multiplying  the  previous  one  by  a   fixed,   non - zero   number   called  the common ratio. For example, the sequences

2, 6, 18, . ...

3, 15, 75 , ….

are a geometric sequences with common ratios 3 and 5 respectively. A geometric sequence is generally characterized by three numbers, the  first  term  ‘ a’,  the  common ratio ‘ r’ and the number of terms ‘ n’. A geometric  series is  the sum of  numbers in a geometric sequence. 2+ 6+ 18 and 3+ 15+ 75 are examples of geometric series with three terms each.

 

The nth term of a geometric series with initial value ‘ a’ and common ratio ‘ r’ is given by: ?? = ???−1. While the sum of a geometric series is given by:

?(1-??−1) / 1-??−1

Create a class Geometric Series to model a Geometric series. Using friend function, overload the ‘~’ operator to  find  the  nth  term  of  the  series. Likewise, overload the ‘!’ operator (using a friend function) to find the sum of a Geometric series.

 

Provide a function display() in the class to display the geometric series. Sample output of the program should be like the following.

 

Sample Program

Output

GeometricSeries series (1,2,4); cout<<"Nth term is: "<<~series<<endl; cout<<"Sum of series is: "<<!series<<endl; cout<<”The complete series is: "<<endl;

series.display();

Nth term is: 8

Sum of series is: 15 The complete series is: 1+2+4+8

a(1 – r")
1- rn
Transcribed Image Text:a(1 – r") 1- rn
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education