Question
In JAVA please 1.Define a class named Circle that represent a circle and contains: An int data field named radius that stores the radius of
In JAVA please
1.Define a class named Circle that represent a circle and contains: An int data field named radius that stores the radius of the circle. A constructor that accepts and creates a cirlce object with the specified radius. A default constructor that uses any default radius value. A getter method for each data. A setter method for each data. A toString method that returns the circle radius, eg 3. A area() method that returns the area of the circle.
2. Write an application CircleTest that creates two circle objects, one with a user-input radius and the other with a radius equal to a random integers between 5 and 15, inclusive. The program will:
-
- print to the screen the area of each circle
-
- swap the radii of the two circles
-
- print to the screen information about the two circles, i.e. toString method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started