Question: Write a Java program which illustrates how to: Create a class Circle , which has: One attribute (radius). Default constructor. Overloaded constructor Function to set
Write a Java program which illustrates how to:
- Create a class Circle, which has:
- One attribute (radius).
- Default constructor.
- Overloaded constructor
- Function to set the radius.
- Three accessor functions to get the (radius, area of circle, volume of sphere).
- Function to display (radius, area, volume).
- In the main function:
- Ask the user to enter value for the radius.
- Make a call to display the attributes.
Given information:
PI = 3.14159
Area = PI * Radius2 ;
Volume = 4.0/3 * PI * Radius3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
