Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Application Development Practice II 13 February 2024

Prac 2: Classes and methods, static methods

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.

You might also like