37.2k views
8 votes
Write a void method named updateRadius which takes a circle and an int and changes the value of the circle's radius to the int. You can call your method in the program's main method so you can test whether it works, but you must remove or comment out the main method before checking your code for a score.

User Dgaviola
by
5.6k points

1 Answer

11 votes

Answer:

public static void updateRadius(Circle circle, int radius){

circle.setRadius(radius);

}

Step-by-step explanation:

Assuming there is a class called Circle which has a method "setRadius", the void function "updateRadius" accepts two arguments namely circle class and the integer radius variable. The setRadius() method of the circle class is used to update the radius of the circle object.

User Wjhguitarman
by
5.3k points