Professional Documents
Culture Documents
ADP262S Prac2 2024
ADP262S Prac2 2024
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 calculations
where possible.
Now write another class that contains a main method in which you construct a
Circle object. Use the JOptionPane class to get the radius value for the object.
Now call the appropriate methods to display the radius, diameter, circumference,
and area of the object.
Use the JOptionPane class to display the values.