Question: Create a class called Circle that has two attributes, one is a constant private PI which is 3.14 and the other one is Radius. The
Create a class called Circle that has two attributes, one is a constant private PI which is 3.14 and the other one is Radius. The class should have a constructor that sets the Radius for any objects created. The class should also have a public method called calculateArea() which calculates the area and returns it. - Write a test program to define a myCircle of type Cirlce (the above class) and show the area of the circle in the output using the calculateArea() method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
