subject

1. write a tostring method for this class. the method should return a string containing the radius and area of the circle.

2. write an equals method for this class. the method should accept a circle object as an argument. it should return true if the argument object contains the same data as the calling object, or false otherwise.

3. write a greaterthan method for this class. the method should accept a circle object as an argument. it should return true if the argument object has an area that is greater than the area of the calling object, or false otherwise.

this is what i have but i have one error that i can't figure out how to fix: the error is line 3, where it says private double radius. when i use the suggested fix on netbeans (which changes it to private final double radius) i just another error saying illegal use of expression or something. can someone

public class circle {
{
private double radius;

public circle(double r)
{
radius = r;
}

public double getarea()
{
return math. pi * radius * radius;
}

public double getradius()
{
return radius;
}

public string tostring()
{
string str;
str = "radius: " + radius +
"area: " + getarea();
return str;
}

public boolean equals(circle c)
{
boolean status;

if(c. getradius() == radius)
status = true;
else
status = false;

return status;
}

public boolean greaterthan(circle c)
{
boolean status;

if(c. getarea() >
status = true;
else
status = false;

return status;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:00
Which of the following “invisible” marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Match the following. 1. show grouping of word processing tasks that can be performed quick access toolbar 2. shortcut location for commonly used elements scroll bars 3. organized commands used to modify documents ribbon 4. used to align and measure content in a word screen zoom bar 5. vertical and horizontal bars that are used to navigate through a document contextual tabs 6. displays the name of the document in use ruler 7. allows users to enlarge or shrink a visual of a word document title bar
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
You know the right answer?
1. write a tostring method for this class. the method should return a string containing the radius a...
Questions
question
Mathematics, 19.08.2019 22:30
Questions on the website: 13722367