Question: Define a class called Circle with data members radius, area, and circumference. The class has the following member functions void set(double); void get(double&, double&,
Define a class called Circle with data members radius, area, and circumference. The class has the following member functions void set(double); void get(double&, double&, double&) const; void calculate Circumference(); The function print prints the values of the components. The function calculate Area calculates the area of the circle using the formula p/ where r is the radius. The function calculateCircumference calculates the circumference of the circle using the formula 2 pr. ;void print() const :(void calculate Area Hint: To find the value of p use the formula 4* atan(1.0). The following driver produces the given sample of input/output: int main() Circle u; double r; cout < < "Enter the radius of the circle: "; cin >> r; u.set(r); u.print(); return 0; Sample Input/Output: Enter the radius of the circle: 3.5 The radius of the circle is: 3.5 The area of the circle is: 38.4845 The circumference of the circle is: 21.9911
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
