Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class CircleTester { public static void main(String[] args) { Circle circ = new Circle(10); circ.radius = 5; System.out.println(circ.toString()); System.out.println(The diameter is + circ.getDiameter());
public class CircleTester { public static void main(String[] args) { Circle circ = new Circle(10); circ.radius = 5; System.out.println(circ.toString()); System.out.println("The diameter is " + circ.getDiameter()); System.out.println("The perimeter is " + circ.getPerimeter()); } public class Circle { public double radius; public double getRadius() { return radius; } public void setRadius(int myRadius) { radius = myRadius; } public Circle(double myRadius) { radius = myRadius; } public double getDiameter() { return radius*2; } public double getPerimeter() { return Math.PI*getDiameter(); } public String toString(){ return "Circle with a radius of " + radius; } The Circle and circleTester have been created, but they have errors. The public and private settings for variables and methods are not all correct. Your job is to go through and fix them. You will need to make edits in both files to get them working correctly, but once complete, your output should match the output below. Sample Output: Circle with a radius of 5.0 The diameter is 10.0 The perimeter is 31.41592653589793
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