I need to check my code has all these requirements.
The requirements for “main()” are:
a. Use an object.
b. Declare all required variables.
c. Output user information.
d. Input the radius 1 and radius 2 to be used to calculate the area of two circles.
e. Use object Circle to access an array that contains the radius of the two circles.
f. Use a function to display the area of the two circles.
Requirements for the function to display the area of the two circles:
a. The function is a void function.
b. The function receives the Circle object using an array.
c. Use a loop which will access the radius of the two circles in the array.
Output the area of the two circles using the function to calculate the area.
#include <iostream>
#include <iomanip>
#include "Circle.h"
using namespace std;
const int NUM_CIRCLES = 2;
int main()
{
Circle circle[NUM_CIRCLES];
cout<<"Chapter 2 Homework\n\n";
cout<<"\n\n";
for (int index = 0; index < NUM_CIRCLES; index++)
{
double r;
cout <<"Enter radius "<< (index+1) << ": ";
cin >> r;
circle[index].setRadius(r);
}
cout << fixed << showpoint << setprecision(1);
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;
}