In C++ Please Modify the program 8-31 from page 584, 585 by adding the following: 1. Add a prototype before main() like: void bubbleSort(Circle [], int); 2. On line 21 add the following function call: bubbleSort(circle, SIZE); 3. After main() function add the definition for bublleSort() function similar to the one on page 628. Evidently you must change the Inventory data type with Circle. The example in the textbook displays all the areas in order because the input is such that will cause the in order output. Your program should display all circles in order even when the input for radii is not in any particular order. // This program uses an array of objects. // The objects are instances of the Circle class. #include #include #include "Circle.h" // Circle class declaration file using namespace std; const int NUM_CIRCLES = 4; int main() { Circle circle[NUM_CIRCLES]; // Define an array of Circle objects // Use a loop to initialize the radius of each object for (int index = 0; index < NUM_CIRCLES; index++) { double r; cout << "Enter the radius for circle " << (index+1) << ": "; cin >> r; circle[index].setRadius(r); } // Use a loop to get and print out the area of each object cout << fixed << showpoint << setprecision(2); cout << "\nHere are the areas of the " << NUM_CIRCLES << " circles.\n"; for (int index = 0; index < NUM_CIRCLES; index++) { cout << "circle " << (index+1) << setw(8) << circle[index].findArea() << endl; } return 0; }

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

In C++ Please

Modify the program 8-31 from page 584, 585 by adding the following:

1. Add a prototype before main() like: void bubbleSort(Circle [], int);

2. On line 21 add the following function call: bubbleSort(circle, SIZE);

3. After main() function add the definition for bublleSort() function similar to the one on page 628. Evidently you must change the Inventory data type with Circle.

The example in the textbook displays all the areas in order because the input is such that will cause the in order output. Your program should display all circles in order even when the input for radii is not in any particular order.

// This program uses an array of objects. // The objects are instances of the Circle class. #include <iostream> #include <iomanip> #include "Circle.h" // Circle class declaration file using namespace std; const int NUM_CIRCLES = 4; int main() { Circle circle[NUM_CIRCLES]; // Define an array of Circle objects // Use a loop to initialize the radius of each object for (int index = 0; index < NUM_CIRCLES; index++) { double r; cout << "Enter the radius for circle " << (index+1) << ": "; cin >> r; circle[index].setRadius(r); } // Use a loop to get and print out the area of each object cout << fixed << showpoint << setprecision(2); cout << "\nHere are the areas of the " << NUM_CIRCLES << " circles.\n"; for (int index = 0; index < NUM_CIRCLES; index++) { cout << "circle " << (index+1) << setw(8) << circle[index].findArea() << endl; } return 0; } 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Reference Types in Function
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.
Similar questions
  • SEE MORE QUESTIONS
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