Computers and Technology

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
CIRCLE. JAVA
public class Circle {
public double radius;
private Circle(double myRadius) {
radius = myRadius;
private void setRadius(int myRadius){
radius = myRadius;
}
private double getDiameter() {
return radius*2;
}
public double getRadius() {
return radius;
}
private double getPerimeter() {
return Math. PI*getDiameter();
}
private String toString() {
return "Circle with a radius of " + radius;
}
}
CIRCLE TESTER. JAVA
public class CircleTester {
public static void main(String[] args) {
Circle circ = new Circle(10);
circ. radius = 5;
System. out. println(circ);
System. out. println("The diameter is " + circ. getDiameter());
System. out. println("The perimeter is " + circ. getPerimeter())
}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, ed72018373
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, deeknuk
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, genyjoannerubiera
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, Maxxboogie
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
Do you know the correct answer?
The Circle and CircleTester have been created, but they have errors. The public and private settings...

Questions in other subjects: