PROGRAMMING:Circle class
A defines the circle class, which includes:
B define the main class. In the main method, complete the following operations
###Input format:
Enter an integer radius from the keyboard
###Output format:
Output the information of C1 and C2 objects respectively
###Input example:
Here is a set of inputs. For example:
```in
four
five
```
```in
-4
-2
```
###Output example:
The corresponding output is given here. For example:
```out
this is a constructor
Circle [radius=2]
c1:area=12
this is a constructor
Circle [radius=2]
Circle [radius=4]
c2:area=50
this is a constructor with para
Circle [radius=5]
c3:area=78
```
```out
this is a constructor
Circle [radius=2]
c1:area=12
this is a constructor
Circle [radius=2]
Circle [radius=2]
c2:area=12
this is a constructor with para
Circle [radius=2]
c3:area=12
```
answer:If there is no answer, please comment
- Member variable definition private int radius
- The method definition includes the following requirements
- Define a parameterless construction method, assign radius to 2, and add the statement system. Out. Println ("this is a constructor") li>
- Define the parametric construction method, receive the user's assignment to radius, if the user's input radius is < = 0, let the radius value be 2, and add the statement system. Out. Println ("this is a constructor with para") li>
- Add setter method for radius to receive the radius input by the user. If the radius input by the user is < = 0, the value of radius will be 2
- Add a getter method for radius to return the radius entered by the user
- Define the method of finding area public int gerarea(), π Instead of using math. PI, the result of the area is cast to int and returned
- Define the toString method. The body of the public string tostring() method is: < br / >
return "Circle [radius=" + radius + "]";
- Define a parameterless construction method, assign radius to 2, and add the statement system. Out. Println ("this is a constructor") li>
B define the main class. In the main method, complete the following operations
- . define and create the first object C1 of circle, and use the println method to output C1
- Find the area of C1 and output
- Define and create the first object C2 of circle, and use the println method to output C2
- Receive the integer radius from the keyboard, assign the value to the radius of C2, and use the println method to output C2
- Find the area of C2 and output
- Receive the integer radius from the keyboard, and create the third object C3 of circle, and pass the user's input integer radius to C3 through the parametric construction method, and use the println method to output C3
- Find the area of C3 and output
###Input format:
Enter an integer radius from the keyboard
###Output format:
Output the information of C1 and C2 objects respectively
###Input example:
Here is a set of inputs. For example:
```in
four
five
```
```in
-4
-2
```
###Output example:
The corresponding output is given here. For example:
```out
this is a constructor
Circle [radius=2]
c1:area=12
this is a constructor
Circle [radius=2]
Circle [radius=4]
c2:area=50
this is a constructor with para
Circle [radius=5]
c3:area=78
```
```out
this is a constructor
Circle [radius=2]
c1:area=12
this is a constructor
Circle [radius=2]
Circle [radius=2]
c2:area=12
this is a constructor with para
Circle [radius=2]
c3:area=12
```
answer:If there is no answer, please comment