Question: C++ Write a Circle class that has the following member variables: radius as a double pi as a double with the value 3.14159 The class
C++
Write a Circle class that has the following member variables:
radius as a double
pi as a double with the value 3.14159
The class should have the following member functions:
Default constructor. Set radius to 0.0.
Constructor: Accepts the radius as a parameter
setRadius: Initializes the radius member
getRadius: Returns the radius value
getArea: Returns the area of the circle (area = pi * radius * radius)
getDiameter: Returns the diameter of the circle (radius * 2)
getCircumference: Returns the circumference of the circle (2 * pi * radius)
Write a program the demonstrates the Circle class by asking the user for the circles radius, creating a Circle object, and then reporting the circles area, circumference, and diameter, fully formatted (2-decimal places) and labelled.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
