Write the class definition for a Circle that has one instance variable (attribute) for the radius. This class must have 2 constructors (one is the default, and the other has one argument).
Also define appropriate get- and set- methods, as well as methods to return the diameter, circumference, and area of a circle.
Use the Math class for your calculations.
Now write another class that contains a main method in which you use each of the constructors to construct 2 Circle objects. Use the Scanner class to get the radius values for each of the objects.
Now call the appropriate methods to display the radius, diameter, circumference, and area of each of the objects. Use the printf method and the tab escape character to format your output.
Also define appropriate get- and set- methods, as well as methods to return the diameter, circumference, and area of a circle.
Use the Math class for your calculations.
Now write another class that contains a main method in which you use each of the constructors to construct 2 Circle objects. Use the Scanner class to get the radius values for each of the objects.
Now call the appropriate methods to display the radius, diameter, circumference, and area of each of the objects. Use the printf method and the tab escape character to format your output.
Comment