subject

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());
}
}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 18:30, aalyssag606
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, cristalcastro901
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, ratpizza
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
image
Computers and Technology, 24.06.2019 15:30, lakenyagillard79
Python. primary u. s. interstate highways are numbered 1-99. odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. thus, the 405 services the 5, and the 290 services the 90. given a highway number, indicate whether it is a primary or auxiliary highway. if auxiliary, indicate what primary highway it serves. also indicate if the (primary) highway runs north/south or east/west.
Answers: 1
You know the right answer?
The Circle and CircleTester have been created, but they have errors. The public and private settings...

Questions in other subjects: