Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

alter the program below so we create an array of five (5) circle elements. Using a loop, we'll ask the user to input the five

alter the program below so we create an array of five (5) circle elements. Using a loop, we'll ask the user to input the five radii and we'll store those in the array.

Write a method that takes the array as a parameter and displays the diameter, circumference and area.

#include using namespace std; class circle {private: double radius; const static double pi=3.14159; public: circle() {radius=0.0; } circle(double r) {setRadius(r); } void setRadius(double r) {radius=r; } double getRadius() {return radius; } double getArea() {return pi*radius*radius; } double getDiameter() {return radius*2; } double getCircumference() { return 2.*pi*radius; } }; int main() {double r; cout<<"Enter radius: "; cin>>r; circle mycircle(r); cout<<"A circle with radius "<

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

What should be included in a code of ethics?

Answered: 1 week ago

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago